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 #ifndef LIBMESH_RB_THETA_EXPANSION_H 21 #define LIBMESH_RB_THETA_EXPANSION_H 22 23 // libMesh includes 24 #include "libmesh/libmesh_common.h" 25 #include "libmesh/reference_counted_object.h" 26 27 // C++ includes 28 #include <vector> 29 #include <memory> 30 31 namespace libMesh 32 { 33 34 class RBTheta; 35 class RBParameters; 36 37 /** 38 * This class stores the set of RBTheta functor objects that define 39 * the "parameter-dependent expansion" of a PDE. 40 * 41 * \author David J. Knezevic 42 * \date 2011 43 */ 44 class RBThetaExpansion : public ReferenceCountedObject<RBThetaExpansion> 45 { 46 public: 47 48 /** 49 * Constructor. 50 */ 51 RBThetaExpansion(); 52 53 /** 54 * Destructor. 55 */ ~RBThetaExpansion()56 virtual ~RBThetaExpansion() {} 57 58 /** 59 * Evaluate theta_q_a at the current parameter. Override 60 * if the theta functions need to be treated differently 61 * in subclasses. 62 */ 63 virtual Number eval_A_theta(unsigned int q, 64 const RBParameters & mu); 65 66 /** 67 * Evaluate theta_q_a at multiple parameters simultaneously. 68 */ 69 virtual std::vector<Number> eval_A_theta(unsigned int q, 70 const std::vector<RBParameters> & mus); 71 72 /** 73 * Evaluate theta_q_f at the current parameter. 74 */ 75 virtual Number eval_F_theta(unsigned int q, 76 const RBParameters & mu); 77 78 /** 79 * Evaluate theta_q_f at multiple parameters simultaneously. 80 */ 81 virtual std::vector<Number> eval_F_theta(unsigned int q, 82 const std::vector<RBParameters> & mus); 83 84 /** 85 * Evaluate theta_q_l at the current parameter. 86 */ 87 virtual Number eval_output_theta(unsigned int output_index, 88 unsigned int q_l, 89 const RBParameters & mu); 90 91 /** 92 * Get Q_a, the number of terms in the affine 93 * expansion for the bilinear form. 94 */ 95 unsigned int get_n_A_terms() const; 96 97 /** 98 * Get Q_f, the number of terms in the affine 99 * expansion for the right-hand side. 100 */ 101 unsigned int get_n_F_terms() const; 102 103 /** 104 * Get n_outputs, the number output functionals. 105 */ 106 unsigned int get_n_outputs() const; 107 108 /** 109 * Get the number of affine terms associated with the specified output. 110 */ 111 unsigned int get_n_output_terms(unsigned int output_index) const; 112 113 /** 114 * Attach a pointer to a functor object that defines one 115 * of the theta_q_a terms. 116 */ 117 virtual void attach_A_theta(RBTheta * theta_q_a); 118 119 /** 120 * Attach a vector of pointers to functor objects that each define one 121 * of the theta_q_a terms. 122 */ 123 virtual void attach_multiple_A_theta(std::vector<std::unique_ptr<RBTheta>> & theta_q_a); 124 125 /** 126 * Attach a pointer to a functor object that defines one 127 * of the theta_q_a terms. 128 */ 129 virtual void attach_F_theta(RBTheta * theta_q_f); 130 131 /** 132 * Attach a vector of pointers to functor objects that each define one 133 * of the theta_q_f terms. 134 */ 135 virtual void attach_multiple_F_theta(std::vector<std::unique_ptr<RBTheta>> & theta_q_f); 136 137 /** 138 * Attach a vector of pointers to functor objects that define one 139 * of the outputs. 140 */ 141 virtual void attach_output_theta(std::vector<std::unique_ptr<RBTheta>> & theta_q_l); 142 143 /** 144 * Attach a vector of pointers to functor objects that define one 145 * of the outputs. 146 */ 147 virtual void attach_output_theta(std::vector<RBTheta*> theta_q_l); 148 149 /** 150 * Attach a pointer to a functor object that defines one 151 * of the outputs. 152 */ 153 virtual void attach_output_theta(RBTheta * theta_q_l); 154 155 156 private: 157 158 /** 159 * Vector storing the pointers to the RBTheta functors for A. 160 */ 161 std::vector<RBTheta *> _A_theta_vector; 162 163 /** 164 * Vector storing the RBTheta functors for the affine expansion of the rhs. 165 */ 166 std::vector<RBTheta *> _F_theta_vector; 167 168 /** 169 * Vector storing the RBTheta functors for the affine expansion of the outputs. 170 */ 171 std::vector<std::vector<RBTheta *>> _output_theta_vector; 172 173 }; 174 175 } 176 177 #endif // LIBMESH_RB_THETA_EXPANSION_H 178