v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PhotonDiffusion::OpCameraInteg Struct Reference
Inheritance diagram for PhotonDiffusion::OpCameraInteg:
[legend]
Collaboration diagram for PhotonDiffusion::OpCameraInteg:
[legend]

Public Member Functions

 OpCameraInteg (boost::shared_ptr< CommonData > common_data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 [Integral_calc]
 

Public Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 

Detailed Description

Definition at line 151 of file photon_diffusion.cpp.

Constructor & Destructor Documentation

◆ OpCameraInteg()

PhotonDiffusion::OpCameraInteg::OpCameraInteg ( boost::shared_ptr< CommonData common_data_ptr)
inline

Definition at line 153 of file photon_diffusion.cpp.

154 : BoundaryEleOp("PHOTON_FLUENCE_RATE", OPROW),
155 commonDataPtr(common_data_ptr) {
156 std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], false);
157 doEntities[MBTRI] = doEntities[MBQUAD] = true;
158 }
BoundaryEle::UserDataOperator BoundaryEleOp
boost::shared_ptr< CommonData > commonDataPtr

Member Function Documentation

◆ doWork()

MoFEMErrorCode PhotonDiffusion::OpCameraInteg::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)

[Integral_calc]

Definition at line 954 of file photon_diffusion.cpp.

955 {
957 const int nb_integration_pts = getGaussPts().size2();
958 const double area = getMeasure();
959 auto t_w = getFTensor0IntegrationWeight();
960 auto t_val = getFTensor0FromVec(*(commonDataPtr->approxVals));
961
962 double values_integ = 0;
963
964#ifdef ENABLE_PYTHON_BINDING
965 VectorDouble sens_vals_vec;
966 if (enable_python) {
967 MatrixDouble ref_coords = getCoordsAtGaussPts();
968 sens_vals_vec =
969 interp_function(interp_image_name, ref_coords, nb_integration_pts,
970 cam_len_x, cam_len_y, "(.*)INTERPOLATION(.*)");
971 }
972#endif
973
974 for (int gg = 0; gg != nb_integration_pts; ++gg) {
975
976 double sens = 1;
977#ifdef ENABLE_PYTHON_BINDING
978 if (enable_python) {
979 sens = sens_vals_vec(gg);
980 }
981#endif
982
983 const double alpha = t_w * area * sens;
984
985 values_integ += alpha * t_val;
986
987 ++t_w;
988 ++t_val;
989 }
990
991 constexpr std::array<int, 1> indices = {CommonData::VALUES_INTEG};
992 std::array<double, 1> values;
993 values[0] = values_integ;
994 CHKERR VecSetValues(commonDataPtr->petscVec, 1, indices.data(), values.data(),
995 ADD_VALUES);
997}
#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.
UBlasVector< double > VectorDouble
Definition Types.hpp:68
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
PetscBool enable_python
double cam_len_x
VectorDouble interp_function(const std::string sens_image, MatrixDouble &m_ref_coords, int nb_gauss_pts, double cam_len_x, double cam_len_y, const std::string block_name)
char interp_image_name[255]
double cam_len_y

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> PhotonDiffusion::OpCameraInteg::commonDataPtr

Definition at line 152 of file photon_diffusion.cpp.


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