v0.13.1
VolumeCalculation.hpp
Go to the documentation of this file.
1/** \file VolumeCalculation.hpp
2
3 * \brief Operator can be used with any volume element to calculate sum of
4 * volumes of all volumes in the set
5
6 */
7
8
9
10#ifndef __VOLUME_CALCULATION_HPP__
11#define __VOLUME_CALCULATION_HPP__
12
13/**
14 * @brief Calculate volume
15 *
16 */
19
21
22 VolumeCalculation(const std::string &field_name, Vec volume_vec)
23 : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
25 volumeVec(volume_vec) {}
26
27 MoFEMErrorCode doWork(int row_side, EntityType row_type,
30
31 // do it only once, no need to repeat this for edges,faces or tets
32 if (row_type != MBVERTEX)
34
35 int nb_gauss_pts = row_data.getN().size1();
36 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
37
38 double vol = getVolume() * getGaussPts()(3, gg);
39
40 CHKERR VecSetValue(volumeVec, 0, vol, ADD_VALUES);
41 }
42
44 }
45};
46
47#endif //__VOLUME_CALCULATION_HPP__
ForcesAndSourcesCore::UserDataOperator UserDataOperator
EntitiesFieldData::EntData EntData
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: MoFEM.hpp:24
constexpr auto field_name
@ OPROW
operator doWork function is executed on FE rows
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Calculate volume.
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
VolumeCalculation(const std::string &field_name, Vec volume_vec)