Programming tasks to Scientific Computing I
errorMeasurements.h
Go to the documentation of this file.
1 #ifndef EXERCISE_3_ERRORMEASUREMENTS_H_
2 #define EXERCISE_3_ERRORMEASUREMENTS_H_
3 
11 
13 template< typename ConfiguratorType >
15  public shellFE::UnitTriangleFENonlinIntegrationScalarIntegratorShellFE <ConfiguratorType, L2NormSqrDiff <ConfiguratorType> >
16 {
17 protected:
21 
22  static const int dim = 3;
23 
24  std::unique_ptr<typename ConfiguratorType::VectorType> _dof;
25  std::unique_ptr<shellFE::DiscreteVectorFunctionDefaultShellFE<ConfiguratorType>> _x;
26 
28 
29 public:
30  L2NormSqrDiff(const ConfiguratorType &conf, const VectorType &numericalSolution)
32  _numericalSolution(this->_config, numericalSolution)
33  {
34  int numGlobalDofs = this->_config.getNumGlobalDofs();
35  const typename ConfiguratorType::InitType &grid = this->_config.getInitializer();
36  _dof.reset(new typename ConfiguratorType::VectorType (dim * numGlobalDofs));
37 
38  for (int i = 0; i < numGlobalDofs; ++i) {
39  for (int c = 0; c < dim; ++c) {
40  (*_dof)[c*numGlobalDofs + i] = grid.getVertex(i)[c];
41  }
42  }
43 
45  }
46 
47  RealType evaluateIntegrand ( const typename ConfiguratorType::ElementType &el, int q) const
48  {
49  RealType nl = 0.0;
50 
52 
53  return nl;
54  }
55 };
56 
58 template<typename ConfiguratorType>
60  public shellFE::UnitTriangleFENonlinIntegrationScalarIntegratorShellFE <ConfiguratorType, H1NormSqrDiff <ConfiguratorType> >
61 {
62 protected:
67 
68  static const int dim = 3;
69 
70  std::unique_ptr<typename ConfiguratorType::VectorType> _dof;
71  std::unique_ptr<shellFE::DiscreteVectorFunctionDefaultShellFE<ConfiguratorType>> _x;
72 
74 
75 public:
76  H1NormSqrDiff(const ConfiguratorType &conf, const VectorType &numericalSolution)
78  _numericalSolution(this->_config, numericalSolution)
79  {
80  int numGlobalDofs = this->_config.getNumGlobalDofs();
81  const typename ConfiguratorType::InitType &grid = this->_config.getInitializer();
82  _dof.reset(new typename ConfiguratorType::VectorType (dim * numGlobalDofs));
83 
84  for (int i = 0; i < numGlobalDofs; ++i) {
85  for (int c = 0; c < dim; ++c) {
86  (*_dof)[c*numGlobalDofs + i] = grid.getVertex(i)[c];
87  }
88  }
89 
91  }
92 
93  RealType evaluateIntegrand ( const typename ConfiguratorType::ElementType &el, int q) const
94  {
95  RealType nl = 0.0;
96 
98 
99  return nl;
100  }
101 };
102 
103 #endif /* EXERCISE_3_ERRORMEASUREMENTS_H_ */
const shellFE::DiscreteFunctionDefaultShellFE< ConfiguratorType > _numericalSolution
Helper class to evaluate a discrete nodal function on a given mesh.
DataTypeContainer::VectorType VectorType
ConfiguratorType::TangentVecType TangentVecType
std::unique_ptr< shellFE::DiscreteVectorFunctionDefaultShellFE< ConfiguratorType > > _x
const Point3DType & getVertex(const int num) const
Definition: triangMesh.h:66
Calculates the norm of the difference between exact and numerical solution.
ConfiguratorType::DomVecType DomVecType
ConfiguratorType::VectorType VectorType
DataTypeContainer::DomVecType DomVecType
DataTypeContainer::RealType RealType
std::unique_ptr< typename ConfiguratorType::VectorType > _dof
static const int dim
const shellFE::DiscreteFunctionDefaultShellFE< ConfiguratorType > _numericalSolution
H1NormSqrDiff(const ConfiguratorType &conf, const VectorType &numericalSolution)
ConfiguratorType::VectorType VectorType
Helper class to evaluate a discrete vector-valued nodal function on a given mesh. ...
DataTypeContainer::TangentVecType TangentVecType
ConfiguratorType::RealType RealType
RealType evaluateIntegrand(const typename ConfiguratorType::ElementType &el, int q) const
std::unique_ptr< typename ConfiguratorType::VectorType > _dof
const InitType & getInitializer() const
Returns the mesh.
Definition: rhs.h:14
L2NormSqrDiff(const ConfiguratorType &conf, const VectorType &numericalSolution)
int getNumGlobalDofs() const
Returns the number of global degrees of freedom.
Calculates the norm of the difference between exact and numerical solution.
RealType evaluateIntegrand(const typename ConfiguratorType::ElementType &el, int q) const
std::unique_ptr< shellFE::DiscreteVectorFunctionDefaultShellFE< ConfiguratorType > > _x
ConfiguratorType::RealType RealType
Base classes for integration type operators defined using the unit triangle.
Configurator for Finite Elements.
Integrator to compute , where is the argument of the operator.
Triangle which has a tangent space at each node.
ConfiguratorType::TangentVecType TangentVecType