18 typedef const int64_t cint64_t;
20 const size_t num_components = uk_man.GetTotalUnknownStructureSize();
22 size_t local_num_point_hits = 0;
23 std::vector<double> local_point_value(num_components, 0.0);
28 const double xmin = xyz_min.x;
29 const double ymin = xyz_min.y;
30 const double zmin = xyz_min.z;
32 const double xmax = xyz_max.x;
33 const double ymax = xyz_max.y;
34 const double zmax = xyz_max.z;
38 if (point.
x >= xmin and point.
x <= xmax and point.
y >= ymin and
39 point.
y <= ymax and point.
z >= zmin and point.
z <= zmax)
41 const auto& grid =
sdm_->Grid();
42 for (
const auto& cell : grid.local_cells)
44 if (grid.CheckPointInsideCell(cell, point))
46 const auto& cell_mapping =
sdm_->GetCellMapping(cell);
47 std::vector<double> shape_values;
48 cell_mapping.ShapeValues(point, shape_values);
50 local_num_point_hits += 1;
52 const size_t num_nodes = cell_mapping.NumNodes();
53 for (
size_t c = 0; c < num_components; ++c)
55 for (
size_t j = 0; j < num_nodes; ++j)
57 cint64_t dof_map_j =
sdm_->MapDOFLocal(cell, j, uk_man, 0, c);
58 const double dof_value_j = field_vector[dof_map_j];
60 local_point_value[c] += dof_value_j * shape_values[j];
69 size_t globl_num_point_hits;
70 MPI_Allreduce(&local_num_point_hits,
71 &globl_num_point_hits,
77 std::vector<double> globl_point_value(num_components, 0.0);
78 MPI_Allreduce(local_point_value.data(),
79 globl_point_value.data(),
86 1.0 /
static_cast<double>(globl_num_point_hits));
88 return globl_point_value;
94 unsigned int component)
const
98 typedef const int64_t cint64_t;
99 const auto& cell_mapping =
sdm_->GetCellMapping(cell);
101 std::vector<double> shape_values;
102 cell_mapping.ShapeValues(position, shape_values);
105 const size_t num_nodes = cell_mapping.NumNodes();
106 for (
size_t j=0; j<num_nodes; ++j)
110 value += field_vector[dof_map] * shape_values[j];
static chi::MPI_Info & mpi
const MPI_Comm & comm
MPI communicator.
const BoundingBox local_grid_bounding_box_
std::unique_ptr< chi_math::GhostedParallelSTLVector > ghosted_field_vector_
virtual std::vector< double > GetPointValue(const chi_mesh::Vector3 &point) const
Returns the component values at requested point.
double Evaluate(const chi_mesh::Cell &cell, const chi_mesh::Vector3 &position, unsigned int component) const override
const chi_math::UnknownManager & GetUnknownManager() const
void Scale(VecDbl &x, const double &val)