26 using namespace MoFEM;
28 static char help[] =
"...\n\n";
41 const int nb_int_pts = getGaussPts().size2();
43 auto t_w = getFTensor0IntegrationWeight();
44 auto t_ho_det = getFTenosr0HoMeasure();
45 double v = getMeasure();
47 for (
int gg = 0; gg != nb_int_pts; gg++) {
48 vol += t_w * t_ho_det * v;
53 CHKERR VecSetValue(vOl, 0, vol, ADD_VALUES);
77 const int nb_int_pts = getGaussPts().size2();
78 auto t_normal = getFTensor1NormalsAtGaussPts();
79 auto t_w = getFTensor0IntegrationWeight();
80 auto t_coords = getFTensor1HoCoordsAtGaussPts();
83 for (
int gg = 0; gg != nb_int_pts; gg++) {
84 vol += (t_coords(
i) * t_normal(
i)) * t_w;
90 CHKERR VecSetValue(vOl, 0, vol, ADD_VALUES);
110 int main(
int argc,
char *argv[]) {
126 DMType dm_name =
"DMMOFEM";
150 auto dm = simple_interface->
getDM();
152 boost::shared_ptr<ForcesAndSourcesCore> domain_fe =
153 boost::shared_ptr<ForcesAndSourcesCore>(
155 boost::shared_ptr<ForcesAndSourcesCore> boundary_fe =
156 boost::shared_ptr<ForcesAndSourcesCore>(
159 domain_fe->getRuleHook =
VolRule();
160 boundary_fe->getRuleHook =
FaceRule();
170 domain_fe->getOpPtrVector().push_back(
171 new OpVolume(
"MESH_NODE_POSITIONS", vol));
173 boundary_fe->getOpPtrVector().push_back(
174 new OpFace(
"MESH_NODE_POSITIONS", surf_vol));
182 CHKERR VecAssemblyBegin(vol);
183 CHKERR VecAssemblyEnd(vol);
184 CHKERR VecGhostUpdateBegin(vol, ADD_VALUES, SCATTER_REVERSE);
185 CHKERR VecGhostUpdateEnd(vol, ADD_VALUES, SCATTER_REVERSE);
186 CHKERR VecAssemblyBegin(surf_vol);
187 CHKERR VecAssemblyEnd(surf_vol);
188 CHKERR VecGhostUpdateBegin(surf_vol, ADD_VALUES, SCATTER_REVERSE);
189 CHKERR VecGhostUpdateEnd(surf_vol, ADD_VALUES, SCATTER_REVERSE);
192 CHKERR VecGetArray(vol, &a_vol);
194 CHKERR VecGetArray(surf_vol, &a_surf_vol);
195 cout <<
"Volume = " << a_vol[0] << endl;
196 cout <<
"Surf Volume = " << a_surf_vol[0] << endl;
197 if (fabs(a_vol[0] - a_surf_vol[0]) > 1e-12) {
200 CHKERR VecRestoreArray(vol, &a_vol);
201 CHKERR VecRestoreArray(vol, &a_surf_vol);
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method)
Executes FEMethod for finite elements in DM.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
FaceElementForcesAndSourcesCoreSwitch< 0 > FaceElementForcesAndSourcesCore
Face finite element default.
VolumeElementForcesAndSourcesCoreSwitch< 0 > VolumeElementForcesAndSourcesCore
Volume finite element default.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
FTensor::Index< 'i', 3 > i
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
auto createSmartGhostVector
Create smart ghost vector.
DeprecatedCoreInterface Interface
SmartPetscObj< Vec > smartVectorDuplicate(SmartPetscObj< Vec > &vec)
Create duplicate vector of smart vector.
int main(int argc, char *argv[])
Set integration rule to boundary elements.
int operator()(int, int, int) const
virtual int get_comm_rank() const =0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Data on single entity (This is passed as argument to DataOperator::doWork)
Deprecated interface functions.
Data operator to do calculations at integration points.
Projection of edge entities with one mid-node on hierarchical basis.
Simple interface for fast problem set-up.
const std::string getBoundaryFEName() const
Get the Boundary FE Name.
MoFEMErrorCode addDomainField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on domain.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode addBoundaryField(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on boundary.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getDomainFEName() const
Get the Domain FE Name.
MoFEMErrorCode getInterface(const MOFEMuuid &uuid, IFACE *&iface) const
Get interface by uuid and return reference to pointer of interface.
default operator for TET element
Volume finite element with switches.
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
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.
OpFace(const std::string &field_name, Vec vol)
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpVolume(const std::string &field_name, Vec vol)
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.
int operator()(int, int, int) const