#include <DGFunction.hpp>


Public Types | |
| 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 |
| void | operator= (const ScalarFunctionBase &f) |
| TinyVector< 3, real_t > | gradient (const TinyVector< 3, real_t > &x) const |
| real_t | dx (const TinyVector< 3 > &x) const |
| real_t | dy (const TinyVector< 3 > &x) const |
| real_t | dz (const TinyVector< 3 > &x) const |
| DGFunction (ConstReferenceCounting< MeshType > mesh) | |
| DGFunction (ConstReferenceCounting< MeshType > mesh, const ScalarFunctionBase &f) | |
| DGFunction (ConstReferenceCounting< MeshType > mesh, const real_t &d) | |
| DGFunction (ConstReferenceCounting< MeshType > mesh, const Vector< real_t > &values) | |
| ~DGFunction () | |
| void | setOutsideValue (const real_t &value) |
| const real_t & | outsideValue () const |
| bool | canBeSimplified () const |
| bool | hasSameType (const DGFunctionBase &f) const |
| ConstReferenceCounting< Mesh > | baseMesh () const |
| const ScalarDiscretizationTypeBase::Type & | discretizationType () const |
| const Vector< real_t > & | values () const |
| real_t & | operator[] (const size_t &i) |
| const real_t & | operator[] (const size_t &i) const |
| 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 Member Functions | |
| std::ostream & | __put (std::ostream &os) const |
Protected Attributes | |
| ConstReferenceCounting< Mesh > | __baseMesh |
| ConstReferenceCounting < ScalarDegreeOfFreedomPositionsSet > | __dofPositionsSet |
| Vector< real_t > | __values |
| const ScalarDiscretizationTypeDG | __discretizationType |
| real_t | __outsideValue |
| const Type | __type |
| std::string | __name |
Private Member Functions | |
| DGFunction (const DGFunction< MeshType, FiniteElementTraits > &f) | |
Private Attributes | |
| ConstReferenceCounting< MeshType > | __mesh |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ScalarFunctionBase &scalarFunction) |
Definition at line 36 of file DGFunction.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 };
| DGFunction< MeshType, FiniteElementTraits >::DGFunction | ( | const DGFunction< MeshType, FiniteElementTraits > & | f | ) | [private] |
Copy constructor
| f | given function |
| DGFunction< MeshType, FiniteElementTraits >::DGFunction | ( | ConstReferenceCounting< MeshType > | mesh | ) | [inline] |
Constructor
| mesh | mesh supporting the function |
Definition at line 217 of file DGFunction.hpp.
00218 : DGFunctionBase(mesh, 00219 ScalarDiscretizationTypeBase::Type(FiniteElementTraits::ScalarDiscretizationTypeBase)), 00220 __mesh(mesh) 00221 { 00222 ; 00223 }
| DGFunction< MeshType, FiniteElementTraits >::DGFunction | ( | ConstReferenceCounting< MeshType > | mesh, | |
| const ScalarFunctionBase & | f | |||
| ) | [inline] |
Constructor
| mesh | mesh supporting the function | |
| f | function of initialization |
Definition at line 231 of file DGFunction.hpp.
00233 : DGFunctionBase(mesh, 00234 ScalarDiscretizationTypeBase::Type(FiniteElementTraits::ScalarDiscretizationTypeBase)), 00235 __mesh(mesh) 00236 { 00237 (*this) = f; 00238 }
| DGFunction< MeshType, FiniteElementTraits >::DGFunction | ( | ConstReferenceCounting< MeshType > | mesh, | |
| const real_t & | d | |||
| ) | [inline] |
Constructor
| mesh | mesh supporting the function | |
| d | value of initialization |
Definition at line 246 of file DGFunction.hpp.
References DGFunctionBase::__values.
00248 : DGFunctionBase(mesh, ScalarDiscretizationTypeBase::Type(FiniteElementTraits::ScalarDiscretizationTypeBase)), 00249 __mesh(mesh) 00250 { 00251 __values = d; 00252 }
| DGFunction< MeshType, FiniteElementTraits >::DGFunction | ( | ConstReferenceCounting< MeshType > | mesh, | |
| const Vector< real_t > & | values | |||
| ) | [inline] |
Constructor
| mesh | given mesh | |
| values | given values |
Definition at line 260 of file DGFunction.hpp.
References DGFunctionBase::__values, ASSERT, and Vector< T >::size().
00262 : DGFunctionBase(mesh, ScalarDiscretizationTypeBase::Type(FiniteElementTraits::ScalarDiscretizationTypeBase)), 00263 __mesh(mesh) 00264 { 00265 ASSERT(__values.size() == values.size()); 00266 __values = values; 00267 }

| DGFunction< MeshType, FiniteElementTraits >::~DGFunction | ( | ) | [inline] |
| real_t DGFunction< MeshType, FiniteElementTraits >::operator() | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual] |
Evaluates the DGFunction at point x.
| x | the position of evaluation |
Implements ScalarFunctionBase.
Definition at line 72 of file DGFunction.hpp.
References DGFunction< MeshType, FiniteElementTraits >::__mesh, DGFunctionBase::__outsideValue, and DGFunctionBase::__values.
00073 { 00074 typename MeshType::const_iterator icell = __mesh->find(x); 00075 if (icell.end()) { 00076 return __outsideValue; 00077 } 00078 00079 const CellType& K = *icell; 00080 Transformation T(K); 00081 00082 TinyVector<3, real_t> xhat; 00083 T.invertT(x, xhat); 00084 00085 real_t value = 0; 00086 for (size_t l=0; l<FiniteElementType::numberOfDegreesOfFreedom; ++l) { 00087 value += __values[(*__dofPositionsSet)(icell.number(),l)]*FiniteElementType::instance().W(l,xhat); 00088 } 00089 00090 return value; 00091 }
| void DGFunction< MeshType, FiniteElementTraits >::operator= | ( | const ScalarFunctionBase & | f | ) | [inline, virtual] |
Affects a function to a DGFunction
| f | original function |
Implements DGFunctionBase.
Definition at line 98 of file DGFunction.hpp.
References DGFunctionBase::__dofPositionsSet, DGFunctionBase::__outsideValue, DGFunctionBase::__values, DGFunctionBase::baseMesh(), DGFunctionBase::discretizationType(), Vector< T >::size(), and ScalarFunctionBase::type().
00099 { 00100 // during an affectation, outside values are set to 0 (the dg 00101 // function is "pure") 00102 __outsideValue = 0; 00103 00104 if (f.type() == this->type()) { 00105 const DGFunctionBase& dgBase = dynamic_cast<const DGFunctionBase&>(f); 00106 if ((dgBase.discretizationType() == this->discretizationType()) and 00107 (dgBase.baseMesh() == this->baseMesh())) { 00108 // if the function is of the same kind: just copy values 00109 const DGFunction<MeshType,FiniteElementTraits>& dg 00110 = dynamic_cast<const DGFunction<MeshType,FiniteElementTraits>&>(dgBase); 00111 __values = dg.__values; 00112 return; 00113 } 00114 } 00115 for (size_t i=0; i<__values.size(); i++) { 00116 const TinyVector<3>& x = __dofPositionsSet->vertex(i); 00117 __values[i] = f(x); 00118 } 00119 }

| TinyVector<3,real_t> DGFunction< MeshType, FiniteElementTraits >::gradient | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual] |
Evaluates the function's gradient at position x
| x | position of evaluation |
Implements DGFunctionBase.
Definition at line 129 of file DGFunction.hpp.
References DGFunction< MeshType, FiniteElementTraits >::__mesh, and DGFunctionBase::__values.
Referenced by DGFunction< MeshType, FiniteElementTraits >::dx(), DGFunction< MeshType, FiniteElementTraits >::dy(), and DGFunction< MeshType, FiniteElementTraits >::dz().
00130 { 00131 typename MeshType::const_iterator icell = __mesh->find(x); 00132 if (icell.end()) { 00133 return 0; 00134 } 00135 00136 const CellType& K = *icell; 00137 Transformation T(K); 00138 00139 TinyVector<3, real_t> xhat; 00140 T.invertT(x, xhat); 00141 00142 TinyVector<3, real_t> referenceGradient = 0; 00143 for (size_t l=0; l<FiniteElementType::numberOfDegreesOfFreedom; ++l) { 00144 const real_t value = __values[(*__dofPositionsSet)(icell.number(),l)]; 00145 referenceGradient[0] += value*FiniteElementType::instance().dxW(l,xhat); 00146 referenceGradient[1] += value*FiniteElementType::instance().dyW(l,xhat); 00147 referenceGradient[2] += value*FiniteElementType::instance().dzW(l,xhat); 00148 } 00149 00150 TinyMatrix<3,3, real_t> J; 00151 { 00152 TinyVector<3, real_t> temp; 00153 00154 T.dx(x,temp); 00155 for(size_t i=0; i<3; ++i) { 00156 J(0,i) = temp[i]; 00157 } 00158 00159 T.dy(x,temp); 00160 for(size_t i=0; i<3; ++i) { 00161 J(1,i) = temp[i]; 00162 } 00163 00164 T.dz(x,temp); 00165 for(size_t i=0; i<3; ++i) { 00166 J(2,i) = temp[i]; 00167 } 00168 } 00169 // now we use 00170 TinyVector<3, real_t> result; 00171 00172 gaussPivot(J, referenceGradient, result); 00173 return result; 00174 }
| real_t DGFunction< MeshType, FiniteElementTraits >::dx | ( | const TinyVector< 3 > & | x | ) | const [inline] |
Evaluates first derivative of the function
| x | position of evaluation |
Definition at line 183 of file DGFunction.hpp.
References DGFunction< MeshType, FiniteElementTraits >::gradient().
00184 { 00185 return gradient(x)[0]; 00186 }

| real_t DGFunction< MeshType, FiniteElementTraits >::dy | ( | const TinyVector< 3 > & | x | ) | const [inline] |
Evaluates second derivative of the function
| x | position of evaluation |
Definition at line 195 of file DGFunction.hpp.
References DGFunction< MeshType, FiniteElementTraits >::gradient().
00196 { 00197 return gradient(x)[1]; 00198 }

| real_t DGFunction< MeshType, FiniteElementTraits >::dz | ( | const TinyVector< 3 > & | x | ) | const [inline] |
Evaluates third derivative of the function
| x | position of evaluation |
Definition at line 207 of file DGFunction.hpp.
References DGFunction< MeshType, FiniteElementTraits >::gradient().
00208 { 00209 return gradient(x)[2]; 00210 }

| std::ostream& DGFunctionBase::__put | ( | std::ostream & | os | ) | const [inline, protected, virtual, inherited] |
output of the DGFunction
| os | output stream |
Implements ScalarFunctionBase.
Definition at line 64 of file DGFunctionBase.hpp.
References DGFunctionBase::__discretizationType, and ScalarDiscretizationTypeBase::name().
00065 { 00066 os << "{dg-" << ScalarDiscretizationTypeBase::name(__discretizationType) << '}'; 00067 return os; 00068 }

| void DGFunctionBase::setOutsideValue | ( | const real_t & | value | ) | [inline, inherited] |
set outside value
| value | outside value |
Definition at line 87 of file DGFunctionBase.hpp.
References DGFunctionBase::__outsideValue.
Referenced by DGFunctionBuilder::build().
00088 { 00089 __outsideValue = value; 00090 }
| const real_t& DGFunctionBase::outsideValue | ( | ) | const [inline, inherited] |
Access to the outside value
Definition at line 97 of file DGFunctionBase.hpp.
References DGFunctionBase::__outsideValue.
00098 { 00099 return __outsideValue; 00100 }
| bool DGFunctionBase::canBeSimplified | ( | ) | const [inline, virtual, inherited] |
Checks if the function can be simplified
Implements ScalarFunctionBase.
Definition at line 107 of file DGFunctionBase.hpp.
| bool DGFunctionBase::hasSameType | ( | const DGFunctionBase & | f | ) | const [inline, inherited] |
Check if a dg function is of the same type
| f | given function |
Definition at line 120 of file DGFunctionBase.hpp.
References DGFunctionBase::__baseMesh, DGFunctionBase::__discretizationType, and ScalarDiscretizationTypeBase::type().
00121 { 00122 return ((__discretizationType.type() == f.__discretizationType.type()) 00123 and (__baseMesh == f.__baseMesh)); 00124 }

| ConstReferenceCounting<Mesh> DGFunctionBase::baseMesh | ( | ) | const [inline, inherited] |
Access to the mesh through its base class
Definition at line 131 of file DGFunctionBase.hpp.
References DGFunctionBase::__baseMesh.
Referenced by DGFunction< MeshType, FiniteElementTraits >::operator=().
00132 { 00133 return __baseMesh; 00134 }
| const ScalarDiscretizationTypeBase::Type& DGFunctionBase::discretizationType | ( | ) | const [inline, inherited] |
The type of the finite elememt function
Definition at line 141 of file DGFunctionBase.hpp.
References DGFunctionBase::__discretizationType, and ScalarDiscretizationTypeBase::type().
Referenced by DGFunction< MeshType, FiniteElementTraits >::operator=().
00142 { 00143 return __discretizationType.type(); 00144 }

| const Vector<real_t>& DGFunctionBase::values | ( | ) | const [inline, inherited] |
Read-only access to the set of values
Definition at line 151 of file DGFunctionBase.hpp.
References DGFunctionBase::__values.
00152 { 00153 return __values; 00154 }
| real_t& DGFunctionBase::operator[] | ( | const size_t & | i | ) | [inline, inherited] |
access to the value at the ith degree of freedom
| i | number of the degree of freedom |
Definition at line 163 of file DGFunctionBase.hpp.
References DGFunctionBase::__values.
00164 { 00165 return __values[i]; 00166 }
| const real_t& DGFunctionBase::operator[] | ( | const size_t & | i | ) | const [inline, inherited] |
Read only Access to the value at the ith degree of freedom
| i | number of the degree of freedom |
Definition at line 175 of file DGFunctionBase.hpp.
References DGFunctionBase::__values.
00176 { 00177 return __values[i]; 00178 }
| 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 }
ConstReferenceCounting<MeshType> DGFunction< MeshType, FiniteElementTraits >::__mesh [private] |
the mesh where the function lives
Definition at line 51 of file DGFunction.hpp.
Referenced by DGFunction< MeshType, FiniteElementTraits >::gradient(), and DGFunction< MeshType, FiniteElementTraits >::operator()().
ConstReferenceCounting<Mesh> DGFunctionBase::__baseMesh [protected, inherited] |
reference to the mesh through the Mesh (basis) class
Definition at line 46 of file DGFunctionBase.hpp.
Referenced by DGFunctionBase::baseMesh(), and DGFunctionBase::hasSameType().
ConstReferenceCounting<ScalarDegreeOfFreedomPositionsSet> DGFunctionBase::__dofPositionsSet [protected, inherited] |
degree of freedom position set
Definition at line 50 of file DGFunctionBase.hpp.
Referenced by DGFunction< MeshType, FiniteElementTraits >::operator=(), and DGFunctionBase::~DGFunctionBase().
Vector<real_t> DGFunctionBase::__values [protected, inherited] |
vector of values
Definition at line 52 of file DGFunctionBase.hpp.
Referenced by DGFunction< MeshType, FiniteElementTraits >::DGFunction(), DGFunction< MeshType, FiniteElementTraits >::gradient(), DGFunction< MeshType, FiniteElementTraits >::operator()(), DGFunctionBase::operator=(), DGFunction< MeshType, FiniteElementTraits >::operator=(), DGFunctionBase::operator[](), and DGFunctionBase::values().
const ScalarDiscretizationTypeDG DGFunctionBase::__discretizationType [protected, inherited] |
type of discretization
Definition at line 55 of file DGFunctionBase.hpp.
Referenced by DGFunctionBase::__put(), DGFunctionBase::discretizationType(), and DGFunctionBase::hasSameType().
real_t DGFunctionBase::__outsideValue [protected, inherited] |
this value is returned when function is evaluated outside the mesh.
(where
is a dg-function and
a constant) to be simplifed (DG functions are considered to be 0 outside the mesh by convention). Definition at line 79 of file DGFunctionBase.hpp.
Referenced by DGFunction< MeshType, FiniteElementTraits >::operator()(), DGFunction< MeshType, FiniteElementTraits >::operator=(), DGFunctionBase::outsideValue(), and DGFunctionBase::setOutsideValue().
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