6#ifndef __DISP_MAP_HPP__
7#define __DISP_MAP_HPP__
32 ifstream in(
fIle.c_str());
35 "file with data points not found");
39 typedef boost::tokenizer<boost::escaped_list_separator<char>> Tokenizer;
44 while (getline(in, line)) {
47 for (Tokenizer::iterator it(tok.begin()), end(tok.end()); it != end;
49 vec.push_back(atof(it->c_str()));
60 PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Get parameters",
"none");
63 CHKERR PetscOptionsScalar(
"-cube_size",
"get cube size for the averaging",
68 "-scale",
"scale the distance between voxels (eg. from mm to m)",
"",
93 vector<double> vec_data;
94 vector<double> vec_dist;
99 int ix = ceil(x /
sCale);
100 int iy = ceil(y /
sCale);
102 vec_ix.resize(2 * nx);
103 vec_iy.resize(2 * ny);
106 for (
int i = 0;
i < 2 * nx;
i++) {
107 int idx = ix - nx +
i;
108 if (idx >= size_x / 2 || idx < -size_x / 2)
114 for (
int i = 0;
i < 2 * ny;
i++) {
115 int idx = iy - ny +
i;
116 if (idx >= size_y / 2 || idx < -size_y / 2)
123 vec_data.resize(vec_iy.size() * vec_ix.size());
124 vec_dist.resize(vec_iy.size() * vec_ix.size());
126 for (vector<int>::iterator it_iy = vec_iy.begin(); it_iy != vec_iy.end();
128 for (vector<int>::iterator it_ix = vec_ix.begin(); it_ix != vec_ix.end();
131 main_vector[*it_iy + size_y / 2][*it_ix + size_x / 2];
132 vec_dist[ii] = ((*it_iy *
sCale - y) * (*it_iy *
sCale - y) +
140 vector<double> kernel;
141 kernel.resize(vec_data.size());
145 const double m = (1 / sqrt(M_PI * 2 * sigma * sigma));
146 for (
int ii = 0; ii < vec_dist.size(); ii++) {
147 kernel[
i] =
m * exp(-(vec_dist[ii]) /
148 (2 * sigma * sigma));
152 for (vector<double>::iterator vec_itr = vec_data.begin();
153 vec_itr != vec_data.end(); vec_itr++) {
155 data += (*vec_itr) * kernel[ii++];
175 PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"",
"none");
178 CHKERR PetscOptionsScalar(
"-lambda",
"lambda parameter",
"", 1, &
lAmbda,
200 MoFEMErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
202 DataForcesAndSourcesCore::EntData &row_data,
203 DataForcesAndSourcesCore::EntData &col_data) {
207 int nb_rows = row_data.getIndices().size();
208 int nb_cols = col_data.getIndices().size();
217 int nb_gauss_pts = row_data.getN().size1();
218 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
223 VectorAdaptor row_base_function = row_data.getN(gg);
224 VectorAdaptor col_base_function = col_data.getN(gg);
226 area * outer_prod(row_base_function, col_base_function);
227 MatrixAdaptor row_diff_base_function = row_data.getDiffN(gg);
228 MatrixAdaptor col_diff_base_function = col_data.getDiffN(gg);
234 prod(row_diff_base_function, trans(col_diff_base_function));
237 &row_data.getIndices()[0], col_data.getIndices().size(),
242 if (row_side != col_side || row_type != col_type) {
248 &col_data.getIndices()[0], row_data.getIndices().size(),
268 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
269 DataForcesAndSourcesCore::EntData &row_data) {
272 if (row_type != MBVERTEX)
275 int nb_rows = row_data.getIndices().size();
284 const int nb_gauss_pts = row_data.getN().size1();
286 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
308 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
309 DataForcesAndSourcesCore::EntData &row_data) {
312 int nb_rows = row_data.getIndices().size();
318 int nb_gauss_pts = row_data.getN().size1();
319 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
322 VectorAdaptor base_function = row_data.getN(gg);
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 ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
implementation of Data Operators for Forces and Sources
FTensor::Index< 'm', 3 > m
VectorDouble locF
Local element rhs vector.
VectorDouble dispAtGaussPts
Values at integration Pts.
MoFEMErrorCode getParameters()
MatrixDouble locA
Local element matrix.
vector< vector< double > > main_vector
MoFEMErrorCode loadFileData()
double getDataForGivenCoordinate(const double x, const double y, vector< vector< double > > &main_vector, const double sCale, const double cUbe_size)
DataFromFiles(string &file)
MoFEMErrorCode fromOptions()
DispMapFe(MoFEM::Interface &mField)
int getRule(int order)
Set integrate rule.
MoFEMErrorCode doWork(int row_side, EntityType row_type, DataForcesAndSourcesCore::EntData &row_data)
OpAssembleRhs(const string &row_field, CommonData &common_data)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
OpCalculateLhs(const std::string &row_field, const std::string &col_field, CommonData &common_data, DataFromFiles &data_from_files)
DataFromFiles & dataFromFiles
OpCalulatefRhoAtGaussPts(const string &row_field, CommonData &common_data, DataFromFiles &data_from_files)
DataFromFiles & dataFromFiles
MoFEMErrorCode doWork(int row_side, EntityType row_type, DataForcesAndSourcesCore::EntData &row_data)
bool sYmm
If true assume that matrix is symmetric structure.
Deprecated interface functions.
default operator for TRI element
double getArea()
get area of face
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
@ OPROW
operator doWork function is executed on FE rows
@ OPROWCOL
operator doWork is executed on FE rows &columns
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element