LCOV - code coverage report
Current view: top level - src/reduced_basis - rb_theta.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 3 10 30.0 %
Date: 2025-08-19 19:27:09 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // rbOOmit: An implementation of the Certified Reduced Basis method.
       2             : // Copyright (C) 2009, 2010 David J. Knezevic
       3             : 
       4             : // This file is part of rbOOmit.
       5             : 
       6             : // rbOOmit is free software; you can redistribute it and/or
       7             : // modify it under the terms of the GNU Lesser General Public
       8             : // License as published by the Free Software Foundation; either
       9             : // version 2.1 of the License, or (at your option) any later version.
      10             : 
      11             : // rbOOmit is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             : // Lesser General Public License for more details.
      15             : 
      16             : // You should have received a copy of the GNU Lesser General Public
      17             : // License along with this library; if not, write to the Free Software
      18             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      19             : 
      20             : // Local includes
      21             : #include "libmesh/rb_theta.h"
      22             : #include "libmesh/rb_parameters.h"
      23             : #include "libmesh/int_range.h"
      24             : 
      25             : namespace libMesh
      26             : {
      27             : 
      28    28491042 : Number RBTheta::evaluate(const RBParameters & mu)
      29             : {
      30             :   // The RBTheta::evaluate() API is not general enough to handle the
      31             :   // multi-sample RBParameters case, and you must therefore call
      32             :   // RBTheta::evaluate_vec() instead.
      33    28491042 :   libmesh_error_msg_if(mu.n_samples() > 1,
      34             :                        "You should only call the evaluate_vec() API when using multi-sample RBParameters objects.");
      35             : 
      36    28491042 :   return 1.;
      37             : }
      38             : 
      39             : std::vector<Number>
      40           0 : RBTheta::evaluate_vec(const std::vector<RBParameters> & mus)
      41             : {
      42             :   // Eventual return value
      43           0 :   std::vector<Number> result;
      44             : 
      45           0 :   for (const auto & mu : mus)
      46             :     {
      47             :       // Backwards-compatible behavior: for single-sample RBParameters objects, we fall back on
      48             :       // calling the scalar evaluate() function for this RBTheta object, which may have been
      49             :       // overridden by the user.
      50           0 :       if (mu.n_samples() == 1)
      51           0 :         result.push_back( this->evaluate(mu) );
      52             :       else
      53             :         {
      54             :           // For multi-sample RBParameters objects, all we can do is return
      55             :           // mu.n_samples() copies of 1 here at the base class level.
      56           0 :           result.insert(result.end(), /*count=*/mu.n_samples(), /*val=*/1.);
      57             :         }
      58             :     }
      59             : 
      60           0 :   return result;
      61             : }
      62             : 
      63             : }

Generated by: LCOV version 1.14