v0.9.0
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)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
boost::weak_ptr< SideNumber > getSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement ()
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
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...
 
const std::string & getFEName () const
 Get name of the element. More...
 
Vec getSnesF () const
 
Vec getSnesX () const
 
Mat getSnesA () const
 
Mat getSnesB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTSa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- 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 left 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 right 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 Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
- 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 93 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 
)

Member Function Documentation

◆ doWork()

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

Definition at line 205 of file PostProcOnRefMesh.cpp.

206  {
208 
209  if (data.getFieldData().size() == 0)
211  if (V) {
212  vAlues.resize(data.getFieldData().size());
213  double *a;
214  CHKERR VecGetArray(V, &a);
215  VectorDofs::iterator it, hi_it;
216  it = data.getFieldDofs().begin();
217  hi_it = data.getFieldDofs().end();
218  for (int ii = 0; it != hi_it; it++, ii++) {
219  int local_idx = getFEMethod()
220  ->rowPtr->find((*it)->getGlobalUniqueId())
221  ->get()
222  ->getPetscLocalDofIdx();
223  vAlues[ii] = a[local_idx];
224  }
225  CHKERR VecRestoreArray(V, &a);
226  vAluesPtr = &vAlues;
227  } else {
228  vAluesPtr = &data.getFieldData();
229  }
230 
231  const MoFEM::FEDofEntity *dof_ptr = data.getFieldDofs()[0].get();
232  int rank = dof_ptr->getNbOfCoeffs();
233 
234  int tag_length = rank * 3;
235  FieldSpace space = dof_ptr->getSpace();
236  switch (space) {
237  case L2:
238  case H1:
239  break;
240  case HCURL:
241  case HDIV:
242  tag_length *= 3;
243  break;
244  default:
245  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
246  "field with that space is not implemented");
247  }
248 
249  double def_VAL[tag_length];
250  bzero(def_VAL, tag_length * sizeof(double));
251  Tag th;
252  CHKERR postProcMesh.tag_get_handle(tagName.c_str(), tag_length,
253  MB_TYPE_DOUBLE, th,
254  MB_TAG_CREAT | MB_TAG_SPARSE, def_VAL);
255 
256  // zero tags, this for Vertex if H1 and TRI if Hdiv, EDGE for Hcurl
257  // no need for L2
258  const void *tags_ptr[mapGaussPts.size()];
259  int nb_gauss_pts = data.getN().size1();
260  if (mapGaussPts.size() != (unsigned int)nb_gauss_pts) {
261  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
262  }
263 
264  switch (space) {
265  case H1:
266  commonData.gradMap[rowFieldName].resize(nb_gauss_pts);
267  if (type == MBVERTEX) {
268  for (int gg = 0; gg < nb_gauss_pts; gg++) {
269  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, def_VAL);
270  (commonData.gradMap[rowFieldName])[gg].resize(rank, 3);
271  (commonData.gradMap[rowFieldName])[gg].clear();
272  }
273  }
274  CHKERR postProcMesh.tag_get_by_ptr(th, &mapGaussPts[0], mapGaussPts.size(),
275  tags_ptr);
276  for (int gg = 0; gg < nb_gauss_pts; gg++) {
277  for (int rr = 0; rr < rank; rr++) {
278  for (int dd = 0; dd < 3; dd++) {
279  for (unsigned int dof = 0; dof < (vAluesPtr->size() / rank); dof++) {
280  const double val =
281  data.getDiffN(gg)(dof, dd) * (*vAluesPtr)[rank * dof + rr];
282  (commonData.gradMap[rowFieldName])[gg](rr, dd) =
283  ((double *)tags_ptr[gg])[rank * rr + dd] += val;
284  }
285  }
286  }
287  }
288  break;
289  case L2:
290  commonData.gradMap[rowFieldName].resize(nb_gauss_pts);
291  for (int gg = 0; gg < nb_gauss_pts; gg++) {
292  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, def_VAL);
293  (commonData.gradMap[rowFieldName])[gg].resize(rank, 3);
294  (commonData.gradMap[rowFieldName])[gg].clear();
295  }
296  CHKERR postProcMesh.tag_get_by_ptr(th, &mapGaussPts[0], mapGaussPts.size(),
297  tags_ptr);
298  for (int gg = 0; gg < nb_gauss_pts; gg++) {
299  for (int rr = 0; rr < rank; rr++) {
300  for (int dd = 0; dd < 3; dd++) {
301  for (unsigned int dof = 0; dof < (vAluesPtr->size() / rank); dof++) {
302  const double val =
303  data.getDiffN(gg)(dof, dd) * (*vAluesPtr)[rank * dof + rr];
304  (commonData.gradMap[rowFieldName])[gg](rr, dd) =
305  ((double *)tags_ptr[gg])[rank * rr + dd] += val;
306  }
307  }
308  }
309  }
310  break;
311  default:
312  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
313  "field with that space is not implemented");
314  }
315 
317 }
field with continuous normal traction
Definition: definitions.h:173
std::map< std::string, std::vector< MatrixDouble > > gradMap
std::vector< EntityHandle > & mapGaussPts
Vec V
const std::string tagName
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FieldCoefficientsNumber getNbOfCoeffs() const
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
CommonData & commonData
keeps information about indexed dofs for the finite element
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
FieldSpace getSpace() const
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:33
moab::Interface & postProcMesh
VectorDouble * vAluesPtr
field with continuous tangents
Definition: definitions.h:172
FieldSpace
approximation spaces
Definition: definitions.h:168
#define CHKERR
Inline error check.
Definition: definitions.h:596
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
continuous field
Definition: definitions.h:171
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDouble & getFieldData() const
get dofs values
VectorDouble vAlues
boost::shared_ptr< const FENumeredDofEntity_multiIndex > rowPtr
Pointer to finite element rows dofs view.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
field with C-1 continuity
Definition: definitions.h:174

Member Data Documentation

◆ commonData

CommonData& PostProcCommonOnRefMesh::OpGetFieldGradientValues::commonData

Definition at line 98 of file PostProcOnRefMesh.hpp.

◆ mapGaussPts

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

Definition at line 97 of file PostProcOnRefMesh.hpp.

◆ postProcMesh

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

Definition at line 96 of file PostProcOnRefMesh.hpp.

◆ tagName

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

Definition at line 99 of file PostProcOnRefMesh.hpp.

◆ V

Vec PostProcCommonOnRefMesh::OpGetFieldGradientValues::V

Definition at line 100 of file PostProcOnRefMesh.hpp.

◆ vAlues

VectorDouble PostProcCommonOnRefMesh::OpGetFieldGradientValues::vAlues

Definition at line 112 of file PostProcOnRefMesh.hpp.

◆ vAluesPtr

VectorDouble* PostProcCommonOnRefMesh::OpGetFieldGradientValues::vAluesPtr

Definition at line 113 of file PostProcOnRefMesh.hpp.


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