Loading [MathJax]/extensions/AMSmath.js
v0.14.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Public Attributes | Private Member Functions | List of all members
MoFEM::FieldEvaluatorInterface Struct Reference

Field evaluator interface. More...

#include <src/interfaces/FieldEvaluator.hpp>

Inheritance diagram for MoFEM::FieldEvaluatorInterface:
[legend]
Collaboration diagram for MoFEM::FieldEvaluatorInterface:
[legend]

Classes

struct  SetPts
 Default evaluator for setting integration points. More...
 
struct  SetPtsData
 

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 FieldEvaluatorInterface (const MoFEM::Core &core)
 
template<typename VE , typename SPD = SetPtsData, typename SP = SetPts>
boost::shared_ptr< SPD > getData (const double *ptr=nullptr, const int nb_eval_points=0, const double eps=1e-12, VERBOSITY_LEVELS verb=QUIET)
 Get the Data object. More...
 
DEPRECATED MoFEMErrorCode buildTree3D (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
DEPRECATED MoFEMErrorCode buildTree2D (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
DEPRECATED MoFEMErrorCode evalFEAtThePoint3D (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
 
DEPRECATED MoFEMErrorCode evalFEAtThePoint2D (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
 
template<int D>
MoFEMErrorCode buildTree (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 Build spatial tree. More...
 
template<int D>
MoFEMErrorCode evalFEAtThePoint (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
 Evaluate field at artbitray position. More...
 
template<>
MoFEMErrorCode buildTree (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
template<>
MoFEMErrorCode buildTree (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
template<>
MoFEMErrorCode evalFEAtThePoint (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh, VERBOSITY_LEVELS verb)
 
template<>
MoFEMErrorCode evalFEAtThePoint (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh, VERBOSITY_LEVELS verb)
 
template<>
MoFEMErrorCode buildTree (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
template<>
MoFEMErrorCode buildTree (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
template<>
MoFEMErrorCode evalFEAtThePoint (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh, VERBOSITY_LEVELS verb)
 
template<>
MoFEMErrorCode evalFEAtThePoint (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh, VERBOSITY_LEVELS verb)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Public Attributes

MoFEM::CorecOre
 

Private Member Functions

template<int D>
MoFEMErrorCode buildTreeImpl (boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
 
template<int D>
MoFEMErrorCode evalFEAtThePointImpl (const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Field evaluator interface.

Examples
dynamic_first_order_con_law.cpp, elasticity.cpp, field_evaluator.cpp, lorentz_force.cpp, plastic.cpp, seepage.cpp, and thermo_elastic.cpp.

Definition at line 21 of file FieldEvaluator.hpp.

Constructor & Destructor Documentation

◆ FieldEvaluatorInterface()

MoFEM::FieldEvaluatorInterface::FieldEvaluatorInterface ( const MoFEM::Core core)

Definition at line 8 of file FieldEvaluator.cpp.

9  : cOre(const_cast<MoFEM::Core &>(core)) {
10 
11  if (!LogManager::checkIfChannelExist("FieldEvaluatorWorld")) {
12  auto core_log = logging::core::get();
13 
15  "FieldEvaluatorWorld"));
17  "FieldEvaluatorSync"));
19  "FieldEvaluatorSelf"));
20 
21  LogManager::setLog("FieldEvaluatorWorld");
22  LogManager::setLog("FieldEvaluatorSync");
23  LogManager::setLog("FieldEvaluatorSelf");
24 
25  MOFEM_LOG_TAG("FieldEvaluatorWorld", "FieldEvaluator");
26  MOFEM_LOG_TAG("FieldEvaluatorSync", "FieldEvaluator");
27  MOFEM_LOG_TAG("FieldEvaluatorSelf", "FieldEvaluator");
28  }
29 
30  MOFEM_LOG("FieldEvaluatorWorld", Sev::noisy) << "Field evaluator intreface";
31 }

Member Function Documentation

◆ buildTree() [1/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)

Definition at line 58 of file FieldEvaluator.cpp.

59  {
60  return buildTreeImpl<2>(spd_ptr, finite_element);
61 }

◆ buildTree() [2/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)

Definition at line 65 of file FieldEvaluator.cpp.

66  {
67  return buildTreeImpl<3>(spd_ptr, finite_element);
68 }

◆ buildTree() [3/5]

template<int D>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)

Build spatial tree.

Parameters
finite_elementfinite element name
Returns
MoFEMErrorCode

◆ buildTree() [4/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)

◆ buildTree() [5/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)

◆ buildTree2D()

MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree2D ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)
Deprecated:
use buildTree<SPACE_DIM>
Examples
field_evaluator.cpp.

Definition at line 77 of file FieldEvaluator.cpp.

78  {
79  return buildTree<2>(spd_ptr, finite_element);
80 }

◆ buildTree3D()

MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTree3D ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)
Deprecated:
use buildTree<SPACE_DIM>
Examples
field_evaluator.cpp, and lorentz_force.cpp.

Definition at line 71 of file FieldEvaluator.cpp.

72  {
73  return buildTree<3>(spd_ptr, finite_element);
74 }

◆ buildTreeImpl()

template<int D>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::buildTreeImpl ( boost::shared_ptr< SetPtsData spd_ptr,
const std::string  finite_element 
)
private

Definition at line 42 of file FieldEvaluator.cpp.

43  {
44  CoreInterface &m_field = cOre;
46  EntityHandle fe_meshset;
47  fe_meshset = m_field.get_finite_element_meshset(finite_element);
48  Range entities;
49  CHKERR m_field.get_moab().get_entities_by_dimension(fe_meshset, D, entities,
50  true);
51  spd_ptr->treePtr.reset(new AdaptiveKDTree(&m_field.get_moab()));
52  CHKERR spd_ptr->treePtr->build_tree(entities, &spd_ptr->rooTreeSet);
54 }

◆ evalFEAtThePoint() [1/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh,
VERBOSITY_LEVELS  verb 
)

◆ evalFEAtThePoint() [2/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh,
VERBOSITY_LEVELS  verb 
)

◆ evalFEAtThePoint() [3/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh,
VERBOSITY_LEVELS  verb 
)

Definition at line 379 of file FieldEvaluator.cpp.

383  {
384  return evalFEAtThePointImpl<2>(point, distance, problem, finite_element,
385  data_ptr, lower_rank, upper_rank, cache_ptr,
386  bh, verb);
387 }

◆ evalFEAtThePoint() [4/5]

template<>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh,
VERBOSITY_LEVELS  verb 
)

Definition at line 390 of file FieldEvaluator.cpp.

394  {
395  return evalFEAtThePointImpl<3>(point, distance, problem, finite_element,
396  data_ptr, lower_rank, upper_rank, cache_ptr,
397  bh, verb);
398 }

◆ evalFEAtThePoint() [5/5]

template<int D>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh = MF_EXIST,
VERBOSITY_LEVELS  verb = QUIET 
)

Evaluate field at artbitray position.

std::array<double, 3> point = {0, 0, 0};
const double dist = 0.3;
std::array<double, 6> eval_points = {-1., -1., -1., 1., 1., 1. };
using VolEle = VolumeElementForcesAndSourcesCore;
auto data_ptr =
getData<VolEle>(point.data(), point.size/3);
if(auto vol_ele = data_ptr->feMethod.lock()) {
// push operators to finite element instance, e.g.
vol_ele->getOpPtrVector().push_back(new MyOp());
// iterate over elemnts with evaluated points
auto cache_ptr = boost::make_shared<CacheTuple>();
CHKERR m_field.cache_problem_entities(prb_ptr->getName(), cache_ptr);
// SPACE_DIM is 3 in this example
CHKERR m_field.getInterface<FieldEvaluatorInterface>()
->evalFEAtThePoint<3>(point.data(), dist, prb_ptr->getName(),
"FINITE_ELEMENT_NAME",
data_ptr, m_field.get_comm_rank(),
m_field.get_comm_rank(), cache_ptr);
}
Parameters
pointpoint used to find tetrahedrons
distancedistance from the point where tetrahedrons are searched
problemproblem name
finite_elementfinite element name
data_ptrpointer to data abut gauss points
lower_ranklower processor
upper_rankupper process
cache_ptrcache or problem entities
bhcontrol looping over entities, e.g. throwing error if element not found
verbverbosity level
Returns
MoFEMErrorCode

◆ evalFEAtThePoint2D()

MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint2D ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh = MF_EXIST,
VERBOSITY_LEVELS  verb = QUIET 
)
Deprecated:
use evalFEAtThePoint<SPACE_DIM>
Examples
field_evaluator.cpp.

Definition at line 409 of file FieldEvaluator.cpp.

413  {
414  return evalFEAtThePoint<2>(point, distance, problem, finite_element, data_ptr,
415  lower_rank, upper_rank, cache_ptr, bh, verb);
416 }

◆ evalFEAtThePoint3D()

MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePoint3D ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh = MF_EXIST,
VERBOSITY_LEVELS  verb = QUIET 
)
Deprecated:
use evalFEAtThePoint<SPACE_DIM>
Examples
field_evaluator.cpp, and lorentz_force.cpp.

Definition at line 400 of file FieldEvaluator.cpp.

404  {
405  return evalFEAtThePoint<3>(point, distance, problem, finite_element, data_ptr,
406  lower_rank, upper_rank, cache_ptr, bh, verb);
407 }

◆ evalFEAtThePointImpl()

template<int D>
MoFEMErrorCode MoFEM::FieldEvaluatorInterface::evalFEAtThePointImpl ( const double *const  point,
const double  distance,
const std::string  problem,
const std::string  finite_element,
boost::shared_ptr< SetPtsData data_ptr,
int  lower_rank,
int  upper_rank,
boost::shared_ptr< CacheTuple cache_ptr,
MoFEMTypes  bh = MF_EXIST,
VERBOSITY_LEVELS  verb = QUIET 
)
private

Definition at line 175 of file FieldEvaluator.cpp.

179  {
180  CoreInterface &m_field = cOre;
182 
183  std::vector<EntityHandle> leafs_out;
184  CHKERR data_ptr->treePtr->distance_search(point, distance, leafs_out);
185  Range tree_ents;
186  for (auto lit : leafs_out)//{
187  CHKERR m_field.get_moab().get_entities_by_dimension(lit, D, tree_ents,
188  true);
189 
190  if (verb >= NOISY)
191  MOFEM_LOG("SELF", Sev::noisy) << "tree entities: " << tree_ents;
192 
193  data_ptr->evalPointEntityHandle.resize(data_ptr->nbEvalPoints);
194  std::fill(data_ptr->evalPointEntityHandle.begin(),
195  data_ptr->evalPointEntityHandle.end(), 0);
196 
197  std::vector<double> local_coords;
198  std::vector<double> shape;
199 
200  auto nb_eval_points = data_ptr->nbEvalPoints;
201 
202  for (auto tet : tree_ents) {
203  const EntityHandle *conn;
204  int num_nodes;
205  CHKERR m_field.get_moab().get_connectivity(tet, conn, num_nodes, true);
206 
207  if constexpr (D == 3) {
208 
209  local_coords.resize(3 * nb_eval_points);
210  shape.resize(4 * nb_eval_points);
211 
212  std::array<double, 12> coords;
213  CHKERR m_field.get_moab().get_coords(conn, num_nodes, coords.data());
214 
216  coords.data(), &data_ptr->evalPoints[0], nb_eval_points,
217  &local_coords[0]);
218  CHKERR Tools::shapeFunMBTET<3>(&shape[0], &local_coords[0],
219  &local_coords[1], &local_coords[2],
220  nb_eval_points);
221 
224  &shape[0], &shape[1], &shape[2], &shape[3]};
226  &data_ptr->shapeFunctions(0, 0), &data_ptr->shapeFunctions(0, 1),
227  &data_ptr->shapeFunctions(0, 2), &data_ptr->shapeFunctions(0, 3)};
228 
231  &local_coords[0], &local_coords[1], &local_coords[2]};
233  &(data_ptr->localCoords(0, 0)), &(data_ptr->localCoords(0, 1)),
234  &(data_ptr->localCoords(0, 2))};
235 
236  for (int n = 0; n != nb_eval_points; ++n) {
237 
238  const double eps = data_ptr->eps;
239  if (t_shape(0) >= 0 - eps && t_shape(0) <= 1 + eps &&
240 
241  t_shape(1) >= 0 - eps && t_shape(1) <= 1 + eps &&
242 
243  t_shape(2) >= 0 - eps && t_shape(2) <= 1 + eps &&
244 
245  t_shape(3) >= 0 - eps && t_shape(3) <= 1 + eps) {
246 
247  data_ptr->evalPointEntityHandle[n] = tet;
248  t_shape_data(i4) = t_shape(i4);
249  t_local_data(j3) = t_local(j3);
250  }
251 
252  ++t_shape;
253  ++t_shape_data;
254  ++t_local;
255  ++t_local_data;
256  }
257  }
258 
259  if constexpr (D == 2) {
260 
261  local_coords.resize(2 * nb_eval_points);
262  shape.resize(3 * nb_eval_points);
263 
264  std::array<double, 9> coords;
265  CHKERR m_field.get_moab().get_coords(conn, num_nodes, coords.data());
266 
268  coords.data(), &data_ptr->evalPoints[0], nb_eval_points,
269  &local_coords[0]);
270  CHKERR Tools::shapeFunMBTRI<2>(&shape[0], &local_coords[0],
271  &local_coords[1], nb_eval_points);
272 
275  &shape[0], &shape[1], &shape[2]};
277  &data_ptr->shapeFunctions(0, 0), &data_ptr->shapeFunctions(0, 1),
278  &data_ptr->shapeFunctions(0, 2)};
279 
282  &local_coords[0], &local_coords[1]};
283  data_ptr->localCoords.resize(nb_eval_points, 2);
285  &(data_ptr->localCoords(0, 0)), &(data_ptr->localCoords(0, 1))};
286 
287  for (int n = 0; n != nb_eval_points; ++n) {
288 
289  const double eps = data_ptr->eps;
290  if (t_shape(0) >= 0 - eps && t_shape(0) <= 1 + eps &&
291 
292  t_shape(1) >= 0 - eps && t_shape(1) <= 1 + eps &&
293 
294  t_shape(2) >= 0 - eps && t_shape(2) <= 1 + eps) {
295 
296  data_ptr->evalPointEntityHandle[n] = tet;
297  t_shape_data(i3) = t_shape(i3);
298  t_local_data(j2) = t_local(j2);
299  }
300 
301  ++t_shape;
302  ++t_shape_data;
303  ++t_local;
304  ++t_local_data;
305  }
306  }
307  }
308 
309  const Problem *prb_ptr;
310  CHKERR m_field.get_problem(problem, &prb_ptr);
311  boost::shared_ptr<NumeredEntFiniteElement_multiIndex> numered_fes(
313 
314  Range in_tets;
315  in_tets.insert_list(data_ptr->evalPointEntityHandle.begin(),
316  data_ptr->evalPointEntityHandle.end());
317  in_tets = in_tets.subset_by_dimension(D);
318 
319  if (verb >= NOISY)
320  MOFEM_LOG("SELF", Sev::noisy) << "in tets: " << in_tets << endl;
321 
322  auto fe_miit =
323  m_field.get_finite_elements()->get<FiniteElement_name_mi_tag>().find(
324  finite_element);
325  if (fe_miit !=
326  m_field.get_finite_elements()->get<FiniteElement_name_mi_tag>().end()) {
327 
328  for (auto peit = in_tets.pair_begin(); peit != in_tets.pair_end(); ++peit) {
329 
330  auto lo =
331  prb_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>().lower_bound(
333  peit->first, (*fe_miit)->getFEUId()));
334  auto hi =
335  prb_ptr->numeredFiniteElementsPtr->get<Unique_mi_tag>().upper_bound(
337  peit->second, (*fe_miit)->getFEUId()));
338  numered_fes->insert(lo, hi);
339 
340  if (verb >= VERY_NOISY)
341  std::cerr << "numered elements:" << std::endl;
342  for (; lo != hi; ++lo)
343  if (verb >= VERY_NOISY)
344  std::cerr << **lo << endl;
345  }
346  if (verb >= VERY_NOISY)
347  std::cerr << std::endl;
348 
349  if (auto fe_ptr = data_ptr->feMethodPtr.lock()) {
350 
351  MOFEM_LOG_C("FieldEvaluatorSync", Sev::verbose,
352  "Number elements %d to evaluate at proc %d",
353  numered_fes->size(), m_field.get_comm_rank());
354  MOFEM_LOG_SYNCHRONISE(m_field.get_comm());
355 
356  if (!cache_ptr) {
357  cache_ptr = boost::make_shared<CacheTuple>();
358  CHKERR m_field.cache_problem_entities(prb_ptr->getName(), cache_ptr);
359 
360  MOFEM_LOG("FieldEvaluatorSync", Sev::noisy)
361  << "If you call that function many times in the loop consider to "
362  "set "
363  "cache_ptr outside of the loop. Otherwise code can be slow.";
364  }
365 
366  CHKERR m_field.loop_finite_elements(prb_ptr, finite_element, *fe_ptr,
367  lower_rank, upper_rank, numered_fes,
368  bh, cache_ptr, verb);
369 
370  } else
371  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
372  "Pointer to element does not exists");
373  }
374 
376 }

◆ getData()

template<typename VE , typename SPD = SetPtsData, typename SP = SetPts>
boost::shared_ptr<SPD> MoFEM::FieldEvaluatorInterface::getData ( const double ptr = nullptr,
const int  nb_eval_points = 0,
const double  eps = 1e-12,
VERBOSITY_LEVELS  verb = QUIET 
)
inline

Get the Data object.

Pack pointers with data structures for field evaluator and finite element. Function return shared pointer if returned shared pointer is reset; all data are destroyed. The idea is to pack all data in one structure, create shared pointer to it and return aliased shared pointer to one of the elements of the data structure. It is a bit complicated, but has great flexibility.

Template Parameters
VE
SetPtsData
SetPts
Parameters
ptr
nb_eval_points
eps
verb
Returns
boost::shared_ptr<SPD>
Examples
field_evaluator.cpp, and lorentz_force.cpp.

Definition at line 107 of file FieldEvaluator.hpp.

108  {
109  struct PackData {
110  boost::scoped_ptr<VE> elePtr;
111  boost::scoped_ptr<SPD> setPtsDataPtr;
112  boost::scoped_ptr<SP> setPtsPtr;
113  };
114  boost::shared_ptr<PackData> pack_data(new PackData());
115  MoFEM::Interface &m_field = cOre;
116  pack_data->elePtr.reset(new VE(m_field));
117 
118  pack_data->setPtsDataPtr.reset(
119  new SPD(boost::shared_ptr<VE>(pack_data, pack_data->elePtr.get()), ptr,
120  nb_eval_points, eps, verb));
121  pack_data->setPtsPtr.reset(new SP(
122  boost::shared_ptr<SPD>(pack_data, pack_data->setPtsDataPtr.get())));
123  pack_data->elePtr->setRuleHook = boost::ref(*pack_data->setPtsPtr);
124  boost::shared_ptr<SPD> data(pack_data, pack_data->setPtsDataPtr.get());
125  return data;
126  }

◆ query_interface()

MoFEMErrorCode MoFEM::FieldEvaluatorInterface::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 33 of file FieldEvaluator.cpp.

34  {
36  *iface = const_cast<FieldEvaluatorInterface *>(this);
38 }

Member Data Documentation

◆ cOre

MoFEM::Core& MoFEM::FieldEvaluatorInterface::cOre

Definition at line 26 of file FieldEvaluator.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::LogManager::checkIfChannelExist
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
EntityHandle
NOISY
@ NOISY
Definition: definitions.h:224
VERY_NOISY
@ VERY_NOISY
Definition: definitions.h:225
MoFEM::FieldEvaluatorInterface::FieldEvaluatorInterface
FieldEvaluatorInterface(const MoFEM::Core &core)
Definition: FieldEvaluator.cpp:8
MoFEM::LogManager::createSink
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Tools::getLocalCoordinatesOnReferenceThreeNodeTri
static MoFEMErrorCode getLocalCoordinatesOnReferenceThreeNodeTri(const double *elem_coords, const double *glob_coords, const int nb_nodes, double *local_coords)
Get the local coordinates on reference three node tri object.
Definition: Tools.cpp:188
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
MoFEM::EntFiniteElement::getLocalUniqueIdCalculate
UId getLocalUniqueIdCalculate() const
Generate UId for finite element entity.
Definition: FEMultiIndices.hpp:528
MOFEM_LOG_SYNCHRONISE
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:345
MoFEM::LogManager::getStrmSync
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:348
MoFEM::FieldEvaluatorInterface::cOre
MoFEM::Core & cOre
Definition: FieldEvaluator.hpp:26
MoFEM::LogManager::getStrmWorld
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
MoFEM::LogManager::getStrmSelf
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:340
MoFEM::Tools::getLocalCoordinatesOnReferenceFourNodeTet
static MoFEMErrorCode getLocalCoordinatesOnReferenceFourNodeTet(const double *elem_coords, const double *glob_coords, const int nb_nodes, double *local_coords)
Get the local coordinates on reference four node tet object.
Definition: Tools.cpp:88
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
MoFEM::VolumeElementForcesAndSourcesCore
Volume finite element base.
Definition: VolumeElementForcesAndSourcesCore.hpp:26
NumeredEntFiniteElement_multiIndex
multi_index_container< boost::shared_ptr< NumeredEntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_EntFiniteElement, UId, &NumeredEntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_RefEntity, EntityHandle, &NumeredEntFiniteElement::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredEntFiniteElement, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > >> >> NumeredEntFiniteElement_multiIndex
MultiIndex for entities for NumeredEntFiniteElement.
Definition: FEMultiIndices.hpp:830
FTensor::Index
Definition: Index.hpp:23
convert.n
n
Definition: convert.py:82
Range
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
MyOp
Operator used to check consistency between local coordinates and global cooridnates for integrated po...
Definition: field_evaluator.cpp:21
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::LogManager::setLog
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359