19 params.
addClassDescription(
"Base class for piecewise linear slope reconstruction to get the "
20 "slopes of element average variables.");
26 _rslope(declareRestartableData<
std::map<dof_id_type,
std::vector<RealGradient>>>(
27 "reconstructed_slopes")),
28 _avars(declareRestartableData<
std::map<dof_id_type,
std::vector<Real>>>(
"avg_var_values")),
30 declareRestartableData<
std::map<
std::pair<dof_id_type, unsigned
int>,
std::vector<Real>>>(
31 "avg_bnd_var_values")),
32 _side_centroid(declareRestartableData<
std::map<
std::pair<dof_id_type, dof_id_type>, Point>>(
35 declareRestartableData<
std::map<
std::pair<dof_id_type, unsigned
int>, Point>>(
36 "bnd_side_centroid")),
38 declareRestartableData<
std::map<
std::pair<dof_id_type, dof_id_type>, Real>>(
"side_area")),
39 _bnd_side_area(declareRestartableData<
std::map<
std::pair<dof_id_type, unsigned
int>, Real>>(
41 _side_normal(declareRestartableData<
std::map<
std::pair<dof_id_type, dof_id_type>, Point>>(
43 _bnd_side_normal(declareRestartableData<
std::map<
std::pair<dof_id_type, unsigned
int>, Point>>(
45 _q_point_face(_assembly.qPointsFace()),
46 _qrule_face(_assembly.qRuleFace()),
47 _JxW_face(_assembly.JxWFace()),
48 _normals_face(_assembly.normals()),
49 _side(_assembly.side()),
50 _side_elem(_assembly.sideElem()),
51 _side_volume(_assembly.sideElemVolume()),
52 _neighbor_elem(_assembly.neighbor()),
53 _side_geoinfo_cached(false)
75 std::vector<std::string> send_buffers(1);
76 std::vector<std::string> recv_buffers;
83 std::back_inserter(recv_buffers));
102const std::vector<RealGradient> &
105 Threads::spin_mutex::scoped_lock lock(
_mutex);
106 std::map<dof_id_type, std::vector<RealGradient>>::const_iterator pos =
_rslope.find(elementid);
110 "Reconstructed slope is not cached for element id '", elementid,
"' in ", __FUNCTION__);
115const std::vector<Real> &
118 Threads::spin_mutex::scoped_lock lock(
_mutex);
119 std::map<dof_id_type, std::vector<Real>>::const_iterator pos =
_avars.find(elementid);
122 mooseError(
"Average variable values are not cached for element id '",
130const std::vector<Real> &
133 Threads::spin_mutex::scoped_lock lock(
_mutex);
134 std::map<std::pair<dof_id_type, unsigned int>, std::vector<Real>>::const_iterator pos =
135 _bnd_avars.find(std::pair<dof_id_type, unsigned int>(elementid, side));
138 mooseError(
"Average variable values are not cached for element id '",
151 Threads::spin_mutex::scoped_lock lock(
_mutex);
152 std::map<std::pair<dof_id_type, dof_id_type>, Point>::const_iterator pos =
153 _side_centroid.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
156 mooseError(
"Side centroid values are not cached for element id '",
158 "' and neighbor id '",
169 Threads::spin_mutex::scoped_lock lock(
_mutex);
170 std::map<std::pair<dof_id_type, unsigned int>, Point>::const_iterator pos =
174 mooseError(
"Boundary side centroid values are not cached for element id '",
187 Threads::spin_mutex::scoped_lock lock(
_mutex);
188 std::map<std::pair<dof_id_type, dof_id_type>, Point>::const_iterator pos =
189 _side_normal.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
192 mooseError(
"Side normal values are not cached for element id '",
194 "' and neighbor id '",
205 Threads::spin_mutex::scoped_lock lock(
_mutex);
206 std::map<std::pair<dof_id_type, unsigned int>, Point>::const_iterator pos =
207 _bnd_side_normal.find(std::pair<dof_id_type, unsigned int>(elementid, side));
210 mooseError(
"Boundary side normal values are not cached for element id '",
223 Threads::spin_mutex::scoped_lock lock(
_mutex);
224 std::map<std::pair<dof_id_type, dof_id_type>, Real>::const_iterator pos =
225 _side_area.find(std::pair<dof_id_type, dof_id_type>(elementid, neighborid));
228 mooseError(
"Side area values are not cached for element id '",
230 "' and neighbor id '",
241 Threads::spin_mutex::scoped_lock lock(
_mutex);
242 std::map<std::pair<dof_id_type, unsigned int>, Real>::const_iterator pos =
243 _bnd_side_area.find(std::pair<dof_id_type, unsigned int>(elementid, side));
246 mooseError(
"Boundary side area values are not cached for element id '",
265 std::ostringstream oss;
269 oss.write((
char *)&size,
sizeof(size));
278 serialized_buffer.assign(oss.str());
285 std::istringstream iss;
288 "Unexpected size of serialized_buffers: " << serialized_buffers.size());
290 for (
auto rank =
decltype(
_app.
n_processors())(0); rank < serialized_buffers.size(); ++rank)
295 iss.str(serialized_buffers[rank]);
300 unsigned int size = 0;
301 iss.read((
char *)&size,
sizeof(size));
303 for (
unsigned int i = 0; i < size; i++)
308 std::vector<RealGradient> value;
312 _rslope.insert(std::pair<dof_id_type, std::vector<RealGradient>>(key, value));
void dataLoad(std::istream &stream, LineSegment &l, void *context)
void dataStore(std::ostream &stream, LineSegment &l, void *context)
void ErrorVector unsigned int
A base class that loops over elements and do things.
virtual void initialize()
std::set< dof_id_type > _interface_elem_ids
List of element IDs that are on the processor boundary and need to be send to other processors.
static InputParameters validParams()
virtual void meshChanged()
void mooseError(Args &&... args) const
virtual void reconstructElementSlope()=0
compute the slope of the cell
std::map< std::pair< dof_id_type, dof_id_type >, Real > & _side_area
store the side area into this map indexed by pair of element ID and neighbor ID
std::map< std::pair< dof_id_type, unsigned int >, std::vector< Real > > & _bnd_avars
store the boundary average variable values into this map indexed by pair of element ID and local side...
std::map< std::pair< dof_id_type, dof_id_type >, Point > & _side_centroid
store the side centroid into this map indexed by pair of element ID and neighbor ID
static InputParameters validParams()
std::map< std::pair< dof_id_type, dof_id_type >, Point > & _side_normal
store the side normal into this map indexed by pair of element ID and neighbor ID
virtual const Real & getBoundarySideArea(dof_id_type elementid, unsigned int side) const
accessor function call to get cached boundary side area
std::map< dof_id_type, std::vector< Real > > & _avars
store the average variable values into this map indexed by element ID
std::map< dof_id_type, std::vector< RealGradient > > & _rslope
store the reconstructed slopes into this map indexed by element ID
virtual const Point & getSideCentroid(dof_id_type elementid, dof_id_type neighborid) const
accessor function call to get cached internal side centroid
virtual const std::vector< Real > & getElementAverageValue(dof_id_type elementid) const
accessor function call to get element average variable values
bool _side_geoinfo_cached
flag to indicated if side geometry info is cached
std::map< std::pair< dof_id_type, unsigned int >, Point > & _bnd_side_normal
store the boundary side normal into this map indexed by pair of element ID and local side ID
virtual void computeElement()
virtual void initialize()
virtual void deserialize(std::vector< std::string > &serialized_buffers)
virtual const Point & getBoundarySideCentroid(dof_id_type elementid, unsigned int side) const
accessor function call to get cached boundary side centroid
virtual void meshChanged()
virtual const Point & getBoundarySideNormal(dof_id_type elementid, unsigned int side) const
accessor function call to get cached boundary side centroid
virtual const Real & getSideArea(dof_id_type elementid, dof_id_type neighborid) const
accessor function call to get cached internal side area
virtual const std::vector< RealGradient > & getElementSlope(dof_id_type elementid) const
accessor function call to get element slope values
virtual const std::vector< Real > & getBoundaryAverageValue(dof_id_type elementid, unsigned int side) const
accessor function call to get boundary average variable values
SlopeReconstructionBase(const InputParameters ¶meters)
virtual void serialize(std::string &serialized_buffer)
std::map< std::pair< dof_id_type, unsigned int >, Real > & _bnd_side_area
store the boundary side area into this map indexed by pair of element ID and local side ID
std::map< std::pair< dof_id_type, unsigned int >, Point > & _bnd_side_centroid
store the boundary side centroid into this map indexed by pair of element ID and local side ID
static Threads::spin_mutex _mutex
virtual const Point & getSideNormal(dof_id_type elementid, dof_id_type neighborid) const
accessor function call to get cached internal side normal
void allgather_packed_range(Context *context, Iter range_begin, const Iter range_end, OutputIter out, std::size_t approx_buffer_size=1000000) const
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
processor_id_type n_processors() const