DiscreteProblemInterface

class DiscreteProblemInterface

Interface for discrete problems.

Subclassed by godzilla::DGProblemInterface, godzilla::FEProblemInterface, godzilla::FVProblemInterface

Public Functions

UnstructuredMesh *get_mesh() const

Get unstructured mesh associated with this problem.

Problem *get_problem() const

Get problem.

Returns:

Problem this interface is part of

virtual Int get_num_fields() const = 0

Get number of fields.

Returns:

The number of fields

virtual std::vector<std::string> get_field_names() const = 0

Get list of all field names.

Returns:

List of field names

virtual const std::string &get_field_name(Int fid) const = 0

Get field name.

Parameters:

fid – Field ID

virtual Int get_field_num_components(Int fid) const = 0

Get number of field components.

Parameters:

fid – Field ID

Returns:

Number of components

virtual Int get_field_id(const std::string &name) const = 0

Get field ID.

Parameters:
  • name – Field name

  • Field – ID

virtual bool has_field_by_id(Int fid) const = 0

Do we have field with specified ID.

Parameters:

fid – The ID of the field

Returns:

True if the field exists, otherwise False

virtual bool has_field_by_name(const std::string &name) const = 0

Do we have field with specified name.

Parameters:

name – The name of the field

Returns:

True if the field exists, otherwise False

virtual Int get_field_order(Int fid) const = 0

Get field order.

Parameters:

fid – Field ID

Returns:

Field order

virtual std::string get_field_component_name(Int fid, Int component) const = 0

Get component name of a field.

Parameters:
  • fid – Field ID

  • component – Component index

Returns:

Component name

virtual void set_field_component_name(Int fid, Int component, const std::string &name) = 0

Set the name of a component of afield variable.

Parameters:
  • fid – Field ID

  • component – Component index

  • name – Component name

virtual Int get_num_aux_fields() const = 0

Get number of auxiliary fields.

Returns:

The number of auxiliary fields

virtual std::vector<std::string> get_aux_field_names() const = 0

Get all auxiliary field names.

Returns:

All auxiliary field names

virtual const std::string &get_aux_field_name(Int fid) const = 0

Get auxiliary field name.

Parameters:

fid – Auxiliary field ID

Returns:

Auxiliary field name

virtual Int get_aux_field_num_components(Int fid) const = 0

Get number of auxiliary field components.

Parameters:

fid – Auxiliary field ID

Returns:

Number of components

virtual Int get_aux_field_id(const std::string &name) const = 0

Get auxiliary field ID.

Parameters:

name – Auxiliary field name

Returns:

Auxiliary field ID

virtual bool has_aux_field_by_id(Int fid) const = 0

Do we have auxiliary field with specified ID.

Parameters:

fid – The ID of the auxiliary field

Returns:

True if the auxiliary field exists, otherwise False

virtual bool has_aux_field_by_name(const std::string &name) const = 0

Do we have auxiliary field with specified name.

Parameters:

name – The name of the auxiliary field

Returns:

True if the auxiliary field exists, otherwise False

virtual Int get_aux_field_order(Int fid) const = 0

Get auxiliary field order.

Parameters:

fid – Auxiliary field ID

Returns:

Auxiliary field order

virtual std::string get_aux_field_component_name(Int fid, Int component) const = 0

Get component name of an auxiliary field.

Parameters:
  • fid – Auxiliary field ID

  • component – Component index

Returns:

Component name

virtual void set_aux_field_component_name(Int fid, Int component, const std::string &name) = 0

Set the name of a component of an auxiliary field variable.

Parameters:
  • fid – Field ID

  • component – Component index

  • name – Component name

const std::vector<InitialCondition*> &get_initial_conditions()

Get list of all initial conditions.

Returns:

List of all initial conditions

const std::vector<InitialCondition*> &get_aux_initial_conditions()

Get list of all auxiliary initial conditions.

Returns:

List of all auxiliary initial conditions

void add_initial_condition(InitialCondition *ic)

Add initial condition.

Parameters:

ic – Initial condition object to add

bool has_initial_condition(const std::string &name) const

Check if we have an initial condition object with a specified name.

Parameters:

name – The name of the object

Returns:

True if the object exists, otherwise false

InitialCondition *get_initial_condition(const std::string &name) const

Get initial condition object with a specified name.

Parameters:

name – The name of the object

Returns:

Pointer to the initial condition object

void add_boundary_condition(BoundaryCondition *bc)

Add essential boundary condition.

Parameters:

bc – Boundary condition object to add

void add_auxiliary_field(AuxiliaryField *aux)

Add auxiliary field.

Parameters:

aux – Auxiliary field object to add

bool has_aux(const std::string &name) const

Check if we have an auxiliary object with a specified name.

Parameters:

name – The name of the object

Returns:

True if the object exists, otherwise false

AuxiliaryField *get_aux(const std::string &name) const

Get auxiliary object with a specified name.

Parameters:

name – The name of the object

Returns:

Pointer to the auxiliary object

Int get_field_dof(Int point, Int fid) const

Return the offset into an array or local Vec for the dof associated with the given point.

Parameters:
  • point – Point

  • fid – Field ID

Returns:

The offset

Int get_aux_field_dof(Int point, Int fid) const

Return the offset into an array of local auxiliary Vec for the dof associated with the given point.

Parameters:
  • point – Point

  • fid – Field ID

Returns:

The offset

const Vector &get_solution_vector_local() const

Get local solution vector.

Returns:

Local solution vector

Vector &get_solution_vector_local()

Get local solution vector.

Returns:

Local solution vector

const Vector &get_aux_solution_vector_local() const

Get local auxiliary solution vector.

Returns:

Local auxiliary solution vector

Vector &get_aux_solution_vector_local()

Get local auxiliary solution vector.

Returns:

Local auxiliary solution vector

template<typename T>
T get_point_local_field_ref(Int point, Int field, Scalar *array) const

Return read/write access to a field on a point in local array.

virtual void compute_solution_vector_local() = 0

Build local solution vector for this problem.