Class FieldFunctionGridBased

Inheritance Relationships

Base Type

Class Documentation

class FieldFunctionGridBased : public opensn::FieldFunction

Public Types

using BoundingBox = std::pair<Vector3, Vector3>
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 &params)
FieldFunctionGridBased(std::string name, std::shared_ptr<SpatialDiscretization> &discretization_ptr, Unknown unknown)

Creates a field function, filling it with zeros.

FieldFunctionGridBased(std::string name, std::shared_ptr<SpatialDiscretization> &discretization_ptr, Unknown unknown, const std::vector<double> &field_vector)

Creates a field function with an associated field vector.

The field’s data vector is set to the incoming field vector.

FieldFunctionGridBased(std::string name, std::shared_ptr<SpatialDiscretization> &discretization_ptr, Unknown unknown, double field_value)

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.

virtual std::vector<double> GetPointValue(const Vector3 &point) const

Returns the component values at requested point.

virtual double Evaluate(const Cell &cell, const Vector3 &position, int component) const override

Evaluates the field function, on a cell, at the specified point, for the given component.

Public Static Functions

static InputParameters GetInputParameters()
static void ExportMultipleToPVTU(const std::string &file_base_name, const std::vector<std::shared_ptr<const FieldFunctionGridBased>> &ff_list)

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_