v0.8.4
Public Member Functions | Public Attributes | List of all members
MoFEM::ProjectionFieldOn10NodeTet Struct Reference

#include <src/approximation/Projection10NodeCoordsOnField.hpp>

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

Public Member Functions

 ProjectionFieldOn10NodeTet (Interface &m_field, std::string _fieldName, bool set_nodes, bool on_coords, std::string on_tag="NoNE")
 
MoFEMErrorCode preProcess ()
 function is run at the beginning of loop More...
 
MoFEMErrorCode operator() ()
 function is run for every finite element More...
 
- Public Member Functions inherited from MoFEM::Projection10NodeCoordsOnField
 Projection10NodeCoordsOnField (Interface &m_field, std::string field_name, int verb=0)
 
MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
- Public Member Functions inherited from MoFEM::DofMethod
MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 DofMethod ()
 
- Public Member Functions inherited from MoFEM::BasicMethod
 BasicMethod ()
 
virtual ~BasicMethod ()
 
int getNinTheLoop () const
 get number of evaluated element in the loop More...
 
int getLoopSize () const
 get loop size More...
 
MoFEMErrorCode copyBasicMethod (const BasicMethod &basic)
 
- Public Member Functions inherited from MoFEM::KspMethod
 KspMethod ()
 
virtual ~KspMethod ()
 
MoFEMErrorCode setKspCtx (const KSPContext &ctx)
 set operator type More...
 
MoFEMErrorCode setKsp (KSP ksp)
 set solver More...
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce 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 ()
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 
- Public Member Functions inherited from MoFEM::SnesMethod
 SnesMethod ()
 
virtual ~SnesMethod ()
 
MoFEMErrorCode setSnesCtx (const SNESContext &ctx)
 Set SNES context. More...
 
MoFEMErrorCode setSnes (SNES snes)
 Set SNES instance. More...
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
- Public Member Functions inherited from MoFEM::TSMethod
 TSMethod ()
 
virtual ~TSMethod ()
 
MoFEMErrorCode setTsCtx (const TSContext &ctx)
 Set Ts context. More...
 
MoFEMErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data. More...
 
MoFEMErrorCode setTs (TS _ts)
 Set TS solver. More...
 

Public Attributes

bool setNodes
 
bool onCoords
 
std::string onTag
 
const int maxApproximationOrder
 
Tag th
 
Field_multiIndex::index< FieldName_mi_tag >::type::iterator field_it
 
VectorDouble L
 
VectorDouble K
 
- Public Attributes inherited from MoFEM::Projection10NodeCoordsOnField
InterfacemField
 
std::string fieldName
 
int vErbose
 
ErrorCode rval
 
VectorDouble coords
 
ublas::vector< double, ublas::bounded_array< double, 3 > > aveMidCoord
 
ublas::vector< double, ublas::bounded_array< double, 3 > > midNodeCoord
 
ublas::vector< double, ublas::bounded_array< double, 3 > > diffNodeCoord
 
ublas::vector< double, ublas::bounded_array< double, 3 > > dOf
 
- Public Attributes inherited from MoFEM::DofMethod
boost::shared_ptr< FieldfieldPtr
 
boost::shared_ptr< DofEntitydofPtr
 
boost::shared_ptr< NumeredDofEntitydofNumeredPtr
 
- Public Attributes inherited from MoFEM::BasicMethod
int nInTheLoop
 
int loopSize
 
int rAnk
 
int sIze
 
const RefEntity_multiIndexrefinedEntitiesPtr
 
const RefElement_multiIndexrefinedFiniteElementsPtr
 
const ProblemproblemPtr
 
const Field_multiIndexfieldsPtr
 
const FieldEntity_multiIndexentitiesPtr
 
const DofEntity_multiIndexdofsPtr
 
const FiniteElement_multiIndexfiniteElementsPtr
 
const EntFiniteElement_multiIndexfiniteElementsEntitiesPtr
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexadjacenciesPtr
 
boost::function< MoFEMErrorCode()> preProcessHook
 
boost::function< MoFEMErrorCode()> postProcessHook
 
boost::function< MoFEMErrorCode()> operatorHook
 
- Public Attributes inherited from MoFEM::KspMethod
KSPContext ksp_ctx
 Context. More...
 
KSP ksp
 KSP solver. More...
 
Vec ksp_f
 the right hand side vector More...
 
Mat ksp_A
 matrix More...
 
Mat ksp_B
 preconditioner matrix More...
 
- Public Attributes inherited from MoFEM::SnesMethod
SNESContext snes_ctx
 
SNES snes
 
Vec snes_x
 
Vec snes_f
 
Mat snes_A
 
Mat snes_B
 
- Public Attributes inherited from MoFEM::TSMethod
TSContext ts_ctx
 
TS ts
 
Vec ts_u
 
Vec ts_u_t
 
Vec ts_F
 
Mat ts_A
 
Mat ts_B
 
PetscInt ts_step
 
PetscReal ts_a
 
PetscReal ts_t
 

Additional Inherited Members

- Public Types inherited from MoFEM::KspMethod
enum  KSPContext { CTX_SETFUNCTION, CTX_OPERATORS, CTX_KSPNONE }
 pass information about context of KSP/DM for with finite element is computed More...
 
- Public Types inherited from MoFEM::SnesMethod
enum  SNESContext { CTX_SNESSETFUNCTION, CTX_SNESSETJACOBIAN, CTX_SNESNONE }
 
- Public Types inherited from MoFEM::TSMethod
enum  TSContext {
  CTX_TSSETRHSFUNCTION, CTX_TSSETRHSJACOBIAN, CTX_TSSETIFUNCTION, CTX_TSSETIJACOBIAN,
  CTX_TSTSMONITORSET, CTX_TSNONE
}
 
- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

Definition at line 136 of file Projection10NodeCoordsOnField.hpp.

Constructor & Destructor Documentation

◆ ProjectionFieldOn10NodeTet()

MoFEM::ProjectionFieldOn10NodeTet::ProjectionFieldOn10NodeTet ( Interface m_field,
std::string  _fieldName,
bool  set_nodes,
bool  on_coords,
std::string  on_tag = "NoNE" 
)

Definition at line 144 of file Projection10NodeCoordsOnField.hpp.

Member Function Documentation

◆ operator()()

MoFEMErrorCode MoFEM::ProjectionFieldOn10NodeTet::operator() ( )
virtual

function is run for every finite element

It is used to calculate element local matrices and assembly. It can be used for post-processing.

Reimplemented from MoFEM::Projection10NodeCoordsOnField.

Definition at line 185 of file Projection10NodeCoordsOnField.hpp.

185  {
187  if(dofPtr->getName() != fieldName) MoFEMFunctionReturnHot(0);
188  if(setNodes) {
189  if(dofPtr->getEntType() == MBVERTEX) {
190  EntityHandle node = dofPtr->getEnt();
191  if(onCoords) {
192  coords.resize(3);
193  rval = mField.get_moab().get_coords(&node,1,&*coords.data().begin()); CHKERRQ_MOAB(rval);
194  coords[dofPtr->getDofCoeffIdx()] = dofPtr->getFieldData();
195  rval = mField.get_moab().set_coords(&node,1,&*coords.data().begin()); CHKERRQ_MOAB(rval);
196  } else {
197  int field_rank = (*field_it)->getNbOfCoeffs();
198  if(field_rank != dofPtr->getNbOfCoeffs()) {
199  SETERRQ(PETSC_COMM_SELF,1,"data inconsistency");
200  }
201  double *tag_value;
202  int tag_size;
203  rval = mField.get_moab().tag_get_by_ptr(
204  th,&node,1,(const void **)&tag_value,&tag_size
205  ); CHKERRQ_MOAB(rval);
206  if(tag_size != dofPtr->getNbOfCoeffs()) {
207  SETERRQ(PETSC_COMM_SELF,1,"data inconsistency");
208  }
209  tag_value[dofPtr->getDofCoeffIdx()] = dofPtr->getFieldData();
210  }
211  }
213  }
214  if(dofPtr->getEntType() != MBEDGE) {
216  }
217  EntityHandle edge = dofPtr->getEnt();
218  if(mField.get_moab().type_from_handle(edge)!=MBEDGE) {
219  SETERRQ(PETSC_COMM_SELF,1,"this method works only elements which are type of MBEDGE");
220  }
221 
222  int num_nodes;
223  const EntityHandle* conn;
224  rval = mField.get_moab().get_connectivity(edge,conn,num_nodes,false); CHKERRQ_MOAB(rval);
225  if( (num_nodes != 2) && (num_nodes != 3) ) {
226  SETERRQ(PETSC_COMM_SELF,1,"this method works only 4 node and 10 node tets");
227  }
228  if(num_nodes == 2) {
230  }
231 
232  if(dofPtr->getDofOrder()>=maxApproximationOrder) {
233  SETERRQ(PETSC_COMM_SELF,1,"too big approximation order, increase constant max_ApproximationOrder");
234  }
235  double approx_val = 0;
236  FieldApproximationBase base = dofPtr->getApproxBase();
237  switch (base) {
239  approx_val = 0.25*L[dofPtr->getDofOrder()-2]*dofPtr->getFieldData();
240  break;
242  approx_val = 0.25*K[dofPtr->getDofOrder()-2]*dofPtr->getFieldData();
243  break;
244  default:
245  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"not yet implemented");
246  }
247 
248  if(onCoords) {
249  coords.resize(num_nodes*3);
250  rval = mField.get_moab().get_coords(conn,num_nodes,&*coords.data().begin()); CHKERRQ_MOAB(rval);
251  if(dofPtr->getEntDofIdx() == dofPtr->getDofCoeffIdx()) {
252  //add only one when higher order terms present
253  double ave_mid = (coords[3*0+dofPtr->getDofCoeffIdx()] + coords[3*1+dofPtr->getDofCoeffIdx()])*0.5;
254  coords[2*3+dofPtr->getDofCoeffIdx()] = ave_mid;
255  }
256  coords[2*3+dofPtr->getDofCoeffIdx()] += approx_val;
257  rval = mField.get_moab().set_coords(&conn[2],1,&coords[3*2]); CHKERRQ_MOAB(rval);
258  } else {
259  int tag_size;
260  double *tag_value[num_nodes];
261  rval = mField.get_moab().tag_get_by_ptr(
262  th,conn,num_nodes,(const void **)tag_value,&tag_size
263  ); CHKERRQ_MOAB(rval);
264  if(tag_size != dofPtr->getNbOfCoeffs()) {
265  SETERRQ(PETSC_COMM_SELF,1,"data inconsistency");
266  }
267  if(dofPtr->getEntDofIdx() == dofPtr->getDofCoeffIdx()) {
268  //add only one when higher order terms present
269  double ave_mid = (tag_value[0][dofPtr->getDofCoeffIdx()] + tag_value[1][dofPtr->getDofCoeffIdx()])*0.5;
270  tag_value[2][dofPtr->getDofCoeffIdx()] = ave_mid;
271  }
272  tag_value[2][dofPtr->getDofCoeffIdx()] += approx_val;
273  }
275  }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:536
boost::shared_ptr< DofEntity > dofPtr
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
FieldApproximationBase
approximation base
Definition: definitions.h:140
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:142
Like AINSWORTH_LEGENDRE_BASE but with Lobatto base instead Legendre .
Definition: definitions.h:143

◆ preProcess()

MoFEMErrorCode MoFEM::ProjectionFieldOn10NodeTet::preProcess ( )
virtual

function is run at the beginning of loop

It is used to zeroing matrices and vectors, calculation of shape functions on reference element, preprocessing boundary conditions, etc.

Reimplemented from MoFEM::Projection10NodeCoordsOnField.

Definition at line 159 of file Projection10NodeCoordsOnField.hpp.

159  {
161  if(!onCoords) {
162  if(onTag == "NoNE") {
163  SETERRQ(PETSC_COMM_SELF,1,"tag name not specified");
164  }
165  field_it = fieldsPtr->get<FieldName_mi_tag>().find(fieldName);
166  if(field_it == fieldsPtr->get<FieldName_mi_tag>().end()) {
167  SETERRQ1(PETSC_COMM_SELF,1,"field not found %s",fieldName.c_str());
168  }
169  int field_rank = (*field_it)->getNbOfCoeffs();
170  VectorDouble def_VAL = ublas::zero_vector<double>(field_rank);
171  rval = mField.get_moab().tag_get_handle(
172  onTag.c_str(),field_rank,MB_TYPE_DOUBLE,
173  th,MB_TAG_CREAT|MB_TAG_SPARSE,&*def_VAL.data().begin()
174  ); MOAB_THROW(rval);
175  }
176 
177  L.resize(maxApproximationOrder+1);
178  ierr = Legendre_polynomials(maxApproximationOrder,0.,NULL,&*L.data().begin(),NULL,3); CHKERRG(ierr);
179  K.resize(10);
180  ierr = LobattoKernel_polynomials(9,0.,NULL,&*K.data().begin(),NULL,3); CHKERRG(ierr);
181 
183  }
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Legendre approximation basis.
virtual moab::Interface & get_moab()=0
const Field_multiIndex * fieldsPtr
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:623
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
PetscErrorCode LobattoKernel_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Kernel Lobatto base functions.
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Common.hpp:211
Field_multiIndex::index< FieldName_mi_tag >::type::iterator field_it

Member Data Documentation

◆ field_it

Field_multiIndex::index<FieldName_mi_tag>::type::iterator MoFEM::ProjectionFieldOn10NodeTet::field_it

Definition at line 155 of file Projection10NodeCoordsOnField.hpp.

◆ K

VectorDouble MoFEM::ProjectionFieldOn10NodeTet::K

Definition at line 157 of file Projection10NodeCoordsOnField.hpp.

◆ L

VectorDouble MoFEM::ProjectionFieldOn10NodeTet::L

Definition at line 156 of file Projection10NodeCoordsOnField.hpp.

◆ maxApproximationOrder

const int MoFEM::ProjectionFieldOn10NodeTet::maxApproximationOrder

Definition at line 142 of file Projection10NodeCoordsOnField.hpp.

◆ onCoords

bool MoFEM::ProjectionFieldOn10NodeTet::onCoords

Definition at line 139 of file Projection10NodeCoordsOnField.hpp.

◆ onTag

std::string MoFEM::ProjectionFieldOn10NodeTet::onTag

Definition at line 140 of file Projection10NodeCoordsOnField.hpp.

◆ setNodes

bool MoFEM::ProjectionFieldOn10NodeTet::setNodes

Definition at line 138 of file Projection10NodeCoordsOnField.hpp.

◆ th

Tag MoFEM::ProjectionFieldOn10NodeTet::th

Definition at line 154 of file Projection10NodeCoordsOnField.hpp.


The documentation for this struct was generated from the following file: