v0.16.3
Loading...
Searching...
No Matches
schrod_eig.hpp
Go to the documentation of this file.
1/**
2 * @file schrod_eig.hpp
3 * @brief Calculate the square of wave function
4 * @date 2025-11-14
5 *
6 * @copyright Copyright (c) 2025
7 *
8 */
9
10#include <MoFEM.hpp>
11
12using namespace MoFEM;
13
14namespace schrod_eig {
15
16//! [Calculate square of wave function]
18 OpSquare(boost::shared_ptr<VectorDouble> squareField,
19 boost::shared_ptr<VectorDouble> field)
22
23 MoFEMErrorCode doWork(int side, EntityType type,
24 DataForcesAndSourcesCore::EntData &data) {
26
27 const size_t nb_gauss_pts = getGaussPts().size2();
28 squareField->resize(nb_gauss_pts, 0);
29
30 auto t_squareField = getFTensor0FromVec(*squareField);
31
32 auto t_field = getFTensor0FromVec(*field);
33
34 for (int gg = 0; gg != nb_gauss_pts; gg++) {
35 t_squareField = t_field * t_field;
36 ++t_field;
37 ++t_squareField;
38 }
39
41 }
42
43private:
44 boost::shared_ptr<VectorDouble> squareField;
45 boost::shared_ptr<VectorDouble> field;
46};
47//! [Calculate square of wave function]
48
49} // namespace schrod_eig
std::string type
@ NOSPACE
Definition definitions.h:83
#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()
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
structure to get information from mofem into EntitiesFieldData
[Calculate square of wave function]
OpSquare(boost::shared_ptr< VectorDouble > squareField, boost::shared_ptr< VectorDouble > field)
boost::shared_ptr< VectorDouble > field
boost::shared_ptr< VectorDouble > squareField
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)