v0.6.9
Public Member Functions | Public Attributes | List of all members
PostProcCommonOnRefMesh::OpGetFieldGradientValues Struct Reference

operator to post-process (save gradients on refined post-processing mesh) field gradient More...

#include <users_modules/basic_finite_elements/src/PostProcOnRefMesh.hpp>

Inheritance diagram for PostProcCommonOnRefMesh::OpGetFieldGradientValues:
[legend]
Collaboration diagram for PostProcCommonOnRefMesh::OpGetFieldGradientValues:
[legend]

Public Member Functions

 OpGetFieldGradientValues (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, const std::string field_name, const std::string tag_name, CommonData &common_data, Vec v=PETSC_NULL)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPLAST, const bool symm=true)
 
 UserDataOperator (const std::string &field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
virtual ~UserDataOperator ()
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
CommonDatacommonData
 
const std::string tagName
 
Vec V
 
VectorDouble vAlues
 
VectorDouble * vAluesPtr
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType { OPROW = 1<<0, OPCOL = 1<<1, OPROWCOL = 1<<2, OPLAST = 1<<3 }
 Controls loop over entities on element. More...
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

operator to post-process (save gradients on refined post-processing mesh) field gradient

Todo:
Implementation for Hdiv and Hcurl to be implemented

Definition at line 97 of file PostProcOnRefMesh.hpp.

Constructor & Destructor Documentation

◆ OpGetFieldGradientValues()

PostProcCommonOnRefMesh::OpGetFieldGradientValues::OpGetFieldGradientValues ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
const std::string  field_name,
const std::string  tag_name,
CommonData common_data,
Vec  v = PETSC_NULL 
)

Definition at line 105 of file PostProcOnRefMesh.hpp.

112  :
113  MoFEM::ForcesAndSourcesCore::UserDataOperator(field_name,UserDataOperator::OPCOL),
114  postProcMesh(post_proc_mesh),
115  mapGaussPts(map_gauss_pts),
116  commonData(common_data),
117  tagName(tag_name),
118  V(v)
119  {}
std::vector< EntityHandle > & mapGaussPts
Vec V
const std::string tagName
CommonData & commonData
moab::Interface & postProcMesh
Data operator to do calculations at integration points.Is inherited and implemented by user to do cal...

Member Function Documentation

◆ doWork()

MoFEMErrorCode PostProcCommonOnRefMesh::OpGetFieldGradientValues::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 218 of file PostProcOnRefMesh.cpp.

222  {
224 
225 
226 
227 
228  if(data.getFieldData().size()==0) MoFEMFunctionReturnHot(0);
229  if(V) {
230  vAlues.resize(data.getFieldData().size());
231  double *a;
232  ierr = VecGetArray(V,&a); CHKERRG(ierr);
233  VectorDofs::iterator it,hi_it;
234  it = data.getFieldDofs().begin();
235  hi_it = data.getFieldDofs().end();
236  for(int ii = 0;it!=hi_it;it++,ii++) {
237  int local_idx = getFEMethod()->rowPtr->find((*it)->getGlobalUniqueId())->get()->getPetscLocalDofIdx();
238  vAlues[ii] = a[local_idx];
239  }
240  ierr = VecRestoreArray(V,&a); CHKERRG(ierr);
241  vAluesPtr = &vAlues;
242  } else {
243  vAluesPtr = &data.getFieldData();
244  }
245 
246  const MoFEM::FEDofEntity *dof_ptr = data.getFieldDofs()[0].get();
247  int rank = dof_ptr->getNbOfCoeffs();
248 
249  int tag_length = rank*3;
250  FieldSpace space = dof_ptr->getSpace();
251  switch(space) {
252  case L2:
253  case H1:
254  break;
255  case HCURL:
256  case HDIV:
257  tag_length *= 3;
258  break;
259  default:
260  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"field with that space is not implemented");
261  }
262 
263  double def_VAL[tag_length];
264  bzero(def_VAL,tag_length*sizeof(double));
265  Tag th;
266  rval = postProcMesh.tag_get_handle(tagName.c_str(),tag_length,MB_TYPE_DOUBLE,th,MB_TAG_CREAT|MB_TAG_SPARSE,def_VAL); CHKERRG(rval);
267 
268  // zero tags, this for Vertex if H1 and TRI if Hdiv, EDGE for Hcurl
269  // no need for L2
270  const void* tags_ptr[mapGaussPts.size()];
271  int nb_gauss_pts = data.getN().size1();
272  if(mapGaussPts.size()!=(unsigned int)nb_gauss_pts) {
273  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
274  }
275 
276  try {
277 
278  switch(space) {
279  case H1:
280  commonData.gradMap[rowFieldName].resize(nb_gauss_pts);
281  if(type == MBVERTEX) {
282  for(int gg = 0;gg<nb_gauss_pts;gg++) {
283  rval = postProcMesh.tag_set_data(th,&mapGaussPts[gg],1,def_VAL); CHKERRG(rval);
284  (commonData.gradMap[rowFieldName])[gg].resize(rank,3);
285  (commonData.gradMap[rowFieldName])[gg].clear();
286  }
287  }
288  rval = postProcMesh.tag_get_by_ptr(th,&mapGaussPts[0],mapGaussPts.size(),tags_ptr); CHKERRG(rval);
289  for(int gg = 0;gg<nb_gauss_pts;gg++) {
290  for(int rr = 0;rr<rank;rr++) {
291  for(int dd = 0;dd<3;dd++) {
292  for(unsigned int dof = 0;dof<(vAluesPtr->size()/rank);dof++) {
293  const double val = data.getDiffN(gg)(dof,dd)*(*vAluesPtr)[rank*dof+rr];
294  (commonData.gradMap[rowFieldName])[gg](rr,dd) = ((double*)tags_ptr[gg])[rank*rr+dd] += val;
295  }
296  }
297  }
298  }
299  break;
300  case L2:
301  commonData.gradMap[rowFieldName].resize(nb_gauss_pts);
302  for(int gg = 0;gg<nb_gauss_pts;gg++) {
303  rval = postProcMesh.tag_set_data(th,&mapGaussPts[gg],1,def_VAL); CHKERRG(rval);
304  (commonData.gradMap[rowFieldName])[gg].resize(rank,3);
305  (commonData.gradMap[rowFieldName])[gg].clear();
306  }
307  rval = postProcMesh.tag_get_by_ptr(th,&mapGaussPts[0],mapGaussPts.size(),tags_ptr); CHKERRG(rval);
308  for(int gg = 0;gg<nb_gauss_pts;gg++) {
309  for(int rr = 0;rr<rank;rr++) {
310  for(int dd = 0;dd<3;dd++) {
311  for(unsigned int dof = 0;dof<(vAluesPtr->size()/rank);dof++) {
312  const double val = data.getDiffN(gg)(dof,dd)*(*vAluesPtr)[rank*dof+rr];
313  (commonData.gradMap[rowFieldName])[gg](rr,dd) = ((double*)tags_ptr[gg])[rank*rr+dd] += val;
314  }
315  }
316  }
317  }
318  break;
319  default:
320  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"field with that space is not implemented");
321  }
322 
323  } catch (std::exception& ex) {
324  std::ostringstream ss;
325  ss << "throw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
326  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
327  }
328 
330 }
field with continuous normal traction
Definition: definitions.h:176
std::vector< EntityHandle > & mapGaussPts
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:468
Vec V
const std::string tagName
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:511
FieldCoefficientsNumber getNbOfCoeffs() const
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:474
CommonData & commonData
std::map< std::string, std::vector< MatrixDouble > > gradMap
virtual const MatrixDouble & getN(const FieldApproximationBase base) const
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb. of columns is equal to number of base functions on this entity
keeps information about indexed dofs for the finite element
virtual const MatrixDouble & getDiffN(const FieldApproximationBase base) const
get derivatives of base functions
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
FieldSpace getSpace() const
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
moab::Interface & postProcMesh
const VectorDouble & getFieldData() const
get dofs values
VectorDouble * vAluesPtr
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T *> &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:28
field with continuous tangents
Definition: definitions.h:177
FieldSpace
approximation spaces
Definition: definitions.h:172
continuous field
Definition: definitions.h:175
VectorDouble vAlues
boost::shared_ptr< const FENumeredDofEntity_multiIndex > rowPtr
field with C-1 continuity
Definition: definitions.h:178

Member Data Documentation

◆ commonData

CommonData& PostProcCommonOnRefMesh::OpGetFieldGradientValues::commonData

Definition at line 101 of file PostProcOnRefMesh.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& PostProcCommonOnRefMesh::OpGetFieldGradientValues::mapGaussPts

Definition at line 100 of file PostProcOnRefMesh.hpp.

◆ postProcMesh

moab::Interface& PostProcCommonOnRefMesh::OpGetFieldGradientValues::postProcMesh

Definition at line 99 of file PostProcOnRefMesh.hpp.

◆ tagName

const std::string PostProcCommonOnRefMesh::OpGetFieldGradientValues::tagName

Definition at line 102 of file PostProcOnRefMesh.hpp.

◆ V

Vec PostProcCommonOnRefMesh::OpGetFieldGradientValues::V

Definition at line 103 of file PostProcOnRefMesh.hpp.

◆ vAlues

VectorDouble PostProcCommonOnRefMesh::OpGetFieldGradientValues::vAlues

Definition at line 121 of file PostProcOnRefMesh.hpp.

◆ vAluesPtr

VectorDouble* PostProcCommonOnRefMesh::OpGetFieldGradientValues::vAluesPtr

Definition at line 122 of file PostProcOnRefMesh.hpp.


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