v0.15.0
Loading...
Searching...
No Matches
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,
28 EntitiesFieldData::EntData &row_data) {
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
#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 ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
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)