Class FieldFunctionGridBased
Defined in File field_function_grid_based.h
Inheritance Relationships
Base Type
public opensn::FieldFunction(Class FieldFunction)
Class Documentation
-
class FieldFunctionGridBased : public opensn::FieldFunction
Public Types
-
using FFList = std::vector<std::shared_ptr<const FieldFunctionGridBased>>
-
using UpdateCallback = std::function<void(FieldFunctionGridBased&)>
-
using CanUpdateCallback = std::function<bool()>
Public Functions
-
explicit FieldFunctionGridBased(const InputParameters ¶ms)
Creates a field function, filling it with zeros.
Creates a field function with an associated field vector.
The field’s data vector is set to the incoming field vector.
Creates a field function where all the values are assigned to the single supplied value.
-
~FieldFunctionGridBased() override = default
-
const SpatialDiscretization &GetSpatialDiscretization() const
Returns the spatial discretization method.
-
std::vector<double> &GetLocalFieldVector()
Returns a reference to the locally stored field data.
-
const std::vector<double> &GetLocalFieldVector() const
Returns a read-only reference to the locally stored field data.
-
std::vector<double> GetGhostedFieldVector() const
Makes a copy of the locally stored data with ghost access.
-
void UpdateFieldVector(const std::vector<double> &field_vector)
Updates the field vector with a local STL vector.
-
void UpdateFieldVector(const Vec &field_vector)
Updates the field vector with a PETSc vector. This only operates locally.
-
bool CanUpdate() const
Returns true if the field function can currently refresh itself from an owner callback.
-
void Update()
Refreshes the field function by invoking its owner callback.
-
void SetUpdateCallback(UpdateCallback callback, CanUpdateCallback can_update_callback = nullptr)
Sets the callback used to refresh this field function.
Public Static Functions
-
static std::vector<std::vector<std::vector<double>>> GetPointValues(const FFList &field_functions, const std::vector<Vector3> &points)
Returns component values for multiple field functions at multiple points.
Point locations and MPI reductions are shared across the field functions. All field functions must use the same mesh. The outer result index selects the field function, the middle index selects the point, and the inner index selects the component. A point on a face of a discontinuous field gets the average over all cells containing it. Collective.
-
static InputParameters GetInputParameters()
Export multiple field functions to PVTU.
Protected Attributes
-
std::shared_ptr<SpatialDiscretization> discretization_
-
std::unique_ptr<GhostedParallelSTLVector> ghosted_field_vector_
-
UpdateCallback update_callback_
-
CanUpdateCallback can_update_callback_
-
using FFList = std::vector<std::shared_ptr<const FieldFunctionGridBased>>