v0.8.17
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...
 
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...
 
- 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 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 
)

Definition at line 102 of file PostProcOnRefMesh.hpp.

108  field_name, UserDataOperator::OPCOL),
109  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
110  commonData(common_data), tagName(tag_name), V(v) {}
std::vector< EntityHandle > & mapGaussPts
Vec V
const std::string tagName
CommonData & commonData
moab::Interface & postProcMesh
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

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

Definition at line 214 of file PostProcOnRefMesh.cpp.

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

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: