#include <ScalarFunctionIntegrate.hpp>


Public Types | |
| enum | Direction { x = 0, y = 1, z = 2 } |
| enum | Type { cfunction, constant, convection, dgfunction, femfunction, linearBasis, spectral, unaryMinus, modulo, sum, difference, product, division, power, min, max, gt, ge, lt, le, ne, eq, and_, or_, xor_, not_, derivate, integrate, normal, domainCharacteristic, meshCharacteristic, objectCharacteristic, composed, references, FEM0, undefined } |
Public Member Functions | |
| real_t | operator() (const TinyVector< 3, real_t > &X) const |
| bool | canBeSimplified () const |
| ScalarFunctionIntegrate (ConstReferenceCounting< ScalarFunctionBase > lowerBound, ConstReferenceCounting< ScalarFunctionBase > upperBound, ConstReferenceCounting< ScalarFunctionBase > functionToIntegrated, const ScalarFunctionIntegrate::Direction &direction) | |
| ScalarFunctionIntegrate (const ScalarFunctionIntegrate &f) | |
| ~ScalarFunctionIntegrate () | |
| void | setName (const std::string &name) |
| const std::string & | name () const |
| const Type & | type () const |
| real_t | operator() (const real_t &x, const real_t &y, const real_t &z) const |
| virtual real_t | dx (const TinyVector< 3, real_t > &x) const |
| virtual real_t | dy (const TinyVector< 3, real_t > &x) const |
| virtual real_t | dz (const TinyVector< 3, real_t > &x) const |
Protected Attributes | |
| const Type | __type |
| std::string | __name |
Private Member Functions | |
| template<typename MeshType> | |
| real_t | __evaluate (const TinyVector< 3, real_t > &X) const |
| std::ostream & | __put (std::ostream &os) const |
Private Attributes | |
| ConstReferenceCounting < ScalarFunctionBase > | __lowerBound |
| ConstReferenceCounting < ScalarFunctionBase > | __upperBound |
| ConstReferenceCounting < FEMFunctionBase > | __functionToIntegrate |
| const Direction | __direction |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ScalarFunctionBase &scalarFunction) |
Definition at line 35 of file ScalarFunctionIntegrate.hpp.
enum ScalarFunctionBase::Type [inherited] |
Definition at line 40 of file ScalarFunctionBase.hpp.
00040 { 00041 cfunction, 00042 constant, 00043 convection, 00044 dgfunction, 00045 femfunction, 00046 linearBasis, 00047 spectral, 00048 unaryMinus, 00049 00050 modulo, 00051 sum, 00052 difference, 00053 product, 00054 division, 00055 power, 00056 00057 min, 00058 max, 00059 00060 gt, 00061 ge, 00062 lt, 00063 le, 00064 ne, 00065 eq, 00066 and_, 00067 or_, 00068 xor_, 00069 00070 not_, 00071 00072 derivate, 00073 integrate, 00074 00075 normal, 00076 00077 domainCharacteristic, 00078 meshCharacteristic, 00079 objectCharacteristic, 00080 00081 composed, 00082 references, 00083 00084 FEM0, 00085 00086 undefined 00087 };
| ScalarFunctionIntegrate::ScalarFunctionIntegrate | ( | ConstReferenceCounting< ScalarFunctionBase > | lowerBound, | |
| ConstReferenceCounting< ScalarFunctionBase > | upperBound, | |||
| ConstReferenceCounting< ScalarFunctionBase > | functionToIntegrated, | |||
| const ScalarFunctionIntegrate::Direction & | direction | |||
| ) |
Constructor
| lowerBound | lower bound of integration | |
| upperBound | upper bound of integration | |
| functionToIntegrated | function to integrate | |
| direction | direction of integration |
Definition at line 202 of file ScalarFunctionIntegrate.cpp.
References __functionToIntegrate, ScalarFunctionBase::femfunction, and ErrorHandler::normal.
00206 : ScalarFunctionBase(ScalarFunctionBase::integrate), 00207 __lowerBound(lowerBound), 00208 __upperBound(upperBound), 00209 __direction(direction) 00210 { 00211 if (functionToIntegrate->type() != ScalarFunctionBase::femfunction) { 00212 std::stringstream errorMsg; 00213 00214 errorMsg << "cannot compute 1D integrale of non FEM functions :-(\n"; 00215 errorMsg << "the function " << (*functionToIntegrate) << " is not of that kind" 00216 << std::ends; 00217 00218 throw ErrorHandler(__FILE__,__LINE__, 00219 errorMsg.str(), 00220 ErrorHandler::normal); 00221 00222 } 00223 const ScalarFunctionBase* f = functionToIntegrate; 00224 __functionToIntegrate = dynamic_cast<const FEMFunctionBase*>(f); 00225 }
| ScalarFunctionIntegrate::ScalarFunctionIntegrate | ( | const ScalarFunctionIntegrate & | f | ) |
Copy contructor
| f | original function |
Definition at line 228 of file ScalarFunctionIntegrate.cpp.
00229 : ScalarFunctionBase(f), 00230 __lowerBound(f.__lowerBound), 00231 __upperBound(f.__upperBound), 00232 __functionToIntegrate(f.__functionToIntegrate), 00233 __direction(f.__direction) 00234 { 00235 ; 00236 }
| ScalarFunctionIntegrate::~ScalarFunctionIntegrate | ( | ) |
| real_t ScalarFunctionIntegrate::__evaluate< Structured3DMesh > | ( | const TinyVector< 3, real_t > & | X | ) | const [inline, private] |
Evaluate the function using the mesh specialization
| X | the position evaluation |
Definition at line 57 of file ScalarFunctionIntegrate.cpp.
References ErrorHandler::unexpected.
00058 { 00059 throw ErrorHandler(__FILE__,__LINE__, 00060 "mesh type not supported", 00061 ErrorHandler::unexpected); 00062 return 0; 00063 }
| std::ostream & ScalarFunctionIntegrate::__put | ( | std::ostream & | os | ) | const [private, virtual] |
Writes the function to a stream
| os | output stream |
Implements ScalarFunctionBase.
Definition at line 29 of file ScalarFunctionIntegrate.cpp.
References __direction, __functionToIntegrate, ErrorHandler::unexpected, x, y, and z.
00030 { 00031 switch(__direction) { 00032 case ScalarFunctionIntegrate::x: { 00033 os << "int[x]("; 00034 break; 00035 } 00036 case ScalarFunctionIntegrate::y: { 00037 os << "int[y]("; 00038 break; 00039 } 00040 case ScalarFunctionIntegrate::z: { 00041 os << "int[z]("; 00042 break; 00043 } 00044 default: { 00045 throw ErrorHandler(__FILE__,__LINE__, 00046 "unknown integrate direction", 00047 ErrorHandler::unexpected); 00048 } 00049 } 00050 os << *__functionToIntegrate << ')'; 00051 return os; 00052 }
| real_t ScalarFunctionIntegrate::operator() | ( | const TinyVector< 3, real_t > & | X | ) | const [virtual] |
Evaluates the function to the position 
| X | position |
Implements ScalarFunctionBase.
Definition at line 189 of file ScalarFunctionIntegrate.cpp.
References __functionToIntegrate, Mesh::cartesianHexahedraMesh, ErrorHandler::normal, and Mesh::type().
00190 { 00191 const Mesh& baseMesh = *__functionToIntegrate->baseMesh(); 00192 if (baseMesh.type() != Mesh::cartesianHexahedraMesh) { 00193 throw ErrorHandler(__FILE__,__LINE__, 00194 "Can only evaluate integrate functions on cartesian structured meshes", 00195 ErrorHandler::normal); 00196 } 00197 00198 return this->__evaluate<Structured3DMesh>(X); 00199 }

| bool ScalarFunctionIntegrate::canBeSimplified | ( | ) | const [inline, virtual] |
Checks if the function can be simplified
Implements ScalarFunctionBase.
Definition at line 86 of file ScalarFunctionIntegrate.hpp.
| void ScalarFunctionBase::setName | ( | const std::string & | name | ) | [inline, inherited] |
Sets the name of the function
| name | name to give to this function |
Definition at line 109 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__name.
Referenced by FunctionExpressionVariable::execute().
| const std::string& ScalarFunctionBase::name | ( | ) | const [inline, inherited] |
Gets the name of the function
Definition at line 119 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__name.
00120 { 00121 return __name; 00122 }
| const Type& ScalarFunctionBase::type | ( | ) | const [inline, inherited] |
Read-only access to the type of the function
Definition at line 129 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__type.
Referenced by WriterVTK::__fillCrossedComponent(), WriterMedit::__fillCrossedComponent(), ScalarFunctionBuilder::Simplifier::__getOperatorF1SimplifiedFunction(), ScalarFunctionBuilder::Simplifier::__getOperatorSimplifiedFunction(), WriterVTK::__proceed(), WriterMedit::__proceedData(), WriterRaw::__saveScalarFunction(), FEMDiscretization< Structured3DMesh, TypeOfDiscretization >::assembleSecondMember(), InstructionAffectation< FunctionExpression, FunctionVariable >::execute(), FEMFunction< MeshType, FiniteElementTraits >::operator=(), and DGFunction< MeshType, FiniteElementTraits >::operator=().
00130 { 00131 return __type; 00132 }
| real_t ScalarFunctionBase::operator() | ( | const real_t & | x, | |
| const real_t & | y, | |||
| const real_t & | z | |||
| ) | const [inline, inherited] |
Evaluates the function at point 
| x | | |
| y | | |
| z | ![]() |
Definition at line 162 of file ScalarFunctionBase.hpp.
00165 { 00166 return this->operator()(TinyVector<3, real_t>(x,y,z)); 00167 }
| virtual real_t ScalarFunctionBase::dx | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates first derivative of the function
| x | position of evaluation |
at position
Definition at line 185 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00186 { 00187 std::stringstream errorMsg; 00188 00189 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00190 errorMsg << "the function " << (*this) << " is not of that kind" 00191 << std::ends; 00192 00193 throw ErrorHandler(__FILE__,__LINE__, 00194 errorMsg.str(), 00195 ErrorHandler::normal); 00196 return 0; 00197 }
| virtual real_t ScalarFunctionBase::dy | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates second derivative of the function
| x | position of evaluation |
at position
Definition at line 206 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00207 { 00208 std::stringstream errorMsg; 00209 00210 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00211 errorMsg << "the function " << (*this) << " is not of that kind" 00212 << std::ends; 00213 00214 throw ErrorHandler(__FILE__,__LINE__, 00215 errorMsg.str(), 00216 ErrorHandler::normal); 00217 return 0; 00218 }
| virtual real_t ScalarFunctionBase::dz | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates third derivative of the function
| x | position of evaluation |
at position
Definition at line 227 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00228 { 00229 std::stringstream errorMsg; 00230 00231 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00232 errorMsg << "the function " << (*this) << " is not of that kind" 00233 << std::ends; 00234 00235 throw ErrorHandler(__FILE__,__LINE__, 00236 errorMsg.str(), 00237 ErrorHandler::normal); 00238 return 0; 00239 }
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const ScalarFunctionBase & | scalarFunction | |||
| ) | [friend, inherited] |
Writes the function scalarFunction to the stream os
| os | the output stream | |
| scalarFunction | the function to write |
Definition at line 142 of file ScalarFunctionBase.hpp.
00144 { 00145 if (scalarFunction.__name.size()>0) { 00146 os << scalarFunction.__name; 00147 return os; 00148 } else { 00149 return scalarFunction.__put(os); 00150 } 00151 }
lower bound of integration
Definition at line 47 of file ScalarFunctionIntegrate.hpp.
upper bound of integration
Definition at line 49 of file ScalarFunctionIntegrate.hpp.
function to integrate
Definition at line 51 of file ScalarFunctionIntegrate.hpp.
Referenced by __put(), operator()(), and ScalarFunctionIntegrate().
const Direction ScalarFunctionIntegrate::__direction [private] |
direction of integration
Definition at line 52 of file ScalarFunctionIntegrate.hpp.
Referenced by __put().
const Type ScalarFunctionBase::__type [protected, inherited] |
type of the function
Definition at line 90 of file ScalarFunctionBase.hpp.
Referenced by ScalarFunctionBase::type().
std::string ScalarFunctionBase::__name [protected, inherited] |
name of the function
Definition at line 92 of file ScalarFunctionBase.hpp.
Referenced by ScalarFunctionBase::name(), and ScalarFunctionBase::setName().
1.5.6