LCOV - code coverage report
Current view: top level - src/series - Cartesian.C (source / functions) Hit Total Coverage
Test: idaholab/moose functional_expansion_tools: #31405 (292dce) with base fef103 Lines: 18 22 81.8 %
Date: 2025-09-04 07:53:29 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "Cartesian.h"
      11             : #include "Legendre.h"
      12             : 
      13             : #include <memory>
      14             : 
      15           0 : Cartesian::Cartesian(const std::string & who_is_using_me)
      16           0 :   : CompositeSeriesBasisInterface(who_is_using_me)
      17             : {
      18           0 : }
      19             : 
      20         389 : Cartesian::Cartesian(const std::vector<MooseEnum> & domains,
      21             :                      const std::vector<std::size_t> & orders,
      22             :                      const std::vector<MooseEnum> & series_types,
      23             :                      const std::string & who_is_using_me,
      24             :                      MooseEnum expansion_type,
      25         389 :                      MooseEnum generation_type)
      26         389 :   : CompositeSeriesBasisInterface(orders, series_types, who_is_using_me)
      27             : {
      28             :   // Initialize the pointers to each of the single series
      29         781 :   for (std::size_t i = 0; i < _series_types.size(); ++i)
      30         394 :     if (_series_types[i] == "Legendre")
      31             :     {
      32         788 :       std::vector<MooseEnum> local_domain = {domains[i]};
      33         394 :       std::vector<std::size_t> local_order = {orders[i]};
      34         394 :       _series.push_back(
      35         394 :           std::make_unique<Legendre>(local_domain, local_order, expansion_type, generation_type));
      36         394 :     }
      37             :     else
      38           0 :       mooseError("Cartesian: No other linear series implemented except Legendre!");
      39             : 
      40             :   /*
      41             :    * Set the _number_of_terms for the composite series by looping over each of the single series.
      42             :    * This also initializes _basis_evaluation with zero values and the appropriate length.
      43             :    */
      44         387 :   setNumberOfTerms();
      45         781 : }
      46             : 
      47             : void
      48         382 : Cartesian::setPhysicalBounds(const std::vector<Real> & bounds)
      49             : {
      50             :   // Each single series is assumed to be a function of a single variable so that it has two bounds
      51         382 :   if (bounds.size() != _series_types.size() * 2)
      52           2 :     mooseError("Cartesian: Mismatch between the physical bounds provided and the number of series "
      53             :                "in the functional basis!");
      54             : 
      55             :   // Update the _physical_bounds of each of the single series
      56             :   unsigned int j = 0;
      57         760 :   for (std::size_t i = 0; i < _series_types.size(); ++i, j += 2)
      58         380 :     _series[i]->setPhysicalBounds({bounds[j], bounds[j + 1]});
      59         380 : }

Generated by: LCOV version 1.14