37 #include "libmesh/getpot.h"
38 #include "libmesh/fem_system.h"
39 #include "libmesh/quadrature_gauss.h"
40 #include "libmesh/elem.h"
41 #include "libmesh/fe.h"
42 #include "libmesh/fe_type.h"
43 #include "libmesh/function_base.h"
47 template<
typename Function>
55 template<
typename Function>
64 template<
typename Function>
67 _p_level(original._p_level),
74 template<
typename Function>
80 template<
typename Function>
86 _rayfire->init(system.get_mesh());
89 template<
typename Function>
92 _rayfire->reinit(system.get_mesh());
95 template<
typename Function>
97 const unsigned int qoi_index )
99 const libMesh::Elem & original_elem = context.get_elem();
100 const libMesh::Elem * rayfire_elem = _rayfire->map_to_rayfire_elem(original_elem.id());
107 libMesh::QGauss qbase(rayfire_elem->dim(),libMesh::Order(_p_level));
108 qbase.init(rayfire_elem->type(),libMesh::Order(_p_level));
111 libMesh::UniquePtr< libMesh::FEGenericBase<libMesh::Real> > fe = libMesh::FEGenericBase<libMesh::Real>::build(rayfire_elem->dim(), libMesh::FEType(libMesh::FIRST, libMesh::LAGRANGE) );
113 fe->attach_quadrature_rule( &qbase );
114 const std::vector<libMesh::Real> & JxW = fe->get_JxW();
115 const std::vector<libMesh::Point> & xyz = fe->get_xyz();
117 fe->reinit(rayfire_elem);
119 const unsigned int n_qpoints = fe->n_quadrature_points();
121 libMesh::Number & qoi = context.get_qois()[qoi_index];
123 for (
unsigned int qp = 0; qp != n_qpoints; ++qp)
124 qoi += this->qoi_value((*_f),context,xyz[qp])*JxW[qp];
129 template<
typename Function>
131 const unsigned int qoi_index )
133 const libMesh::Elem& original_elem = context.get_elem();
134 const libMesh::Elem* rayfire_elem = _rayfire->map_to_rayfire_elem(original_elem.id());
141 libMesh::QGauss qbase(rayfire_elem->dim(),libMesh::Order(_p_level));
142 qbase.init(rayfire_elem->type(),libMesh::Order(_p_level));
145 libMesh::UniquePtr< libMesh::FEGenericBase<libMesh::Real> > fe = libMesh::FEGenericBase<libMesh::Real>::build(rayfire_elem->dim(), libMesh::FEType(libMesh::FIRST, libMesh::LAGRANGE) );
147 fe->attach_quadrature_rule( &qbase );
148 const std::vector<libMesh::Real> & JxW = fe->get_JxW();
149 const std::vector<libMesh::Point> & xyz = fe->get_xyz();
151 fe->reinit(rayfire_elem);
153 const unsigned int n_qpoints = fe->n_quadrature_points();
156 for (
unsigned int qp = 0; qp != n_qpoints; qp++)
157 this->qoi_derivative((*_f),context,xyz[qp],JxW[qp],qoi_index);
166 return f(context,xyz);
178 const libMesh::Point & qp_xyz,
const libMesh::Real JxW,
const unsigned int qoi_index)
185 const libMesh::Point & ,
const libMesh::Real ,
const unsigned int )
virtual void reinit(MultiphysicsSystem &system)
Reinitialize the rayfire.
virtual QoIBase * clone() const
Required to provide clone (deep-copy) for adding QoI object to libMesh objects.
libMesh::UniquePtr< RayfireMesh > _rayfire
Pointer to RayfireMesh object.
virtual void derivatives(libMesh::FEMContext &context, const libMesh::Point &qp_xyz, const libMesh::Real &JxW, const unsigned int qoi_index, const libMesh::Real time=0.)=0
Function Derivative Evaluation.
virtual void element_qoi(AssemblyContext &context, const unsigned int qoi_index)
Compute the qoi value.
virtual void init(const GetPot &input, const MultiphysicsSystem &system, unsigned int qoi_num)
Initializes the rayfire with the mesh from system.
Interface with libMesh for solving Multiphysics problems.
virtual void element_qoi_derivative(AssemblyContext &context, const unsigned int qoi_index)
Compute the qoi derivative with respect to the solution.
IntegratedFunction()
User cannot call empty constructor.