BELFEM 0.9.3
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::fem::Kernel Class Reference

Top-level orchestrator. More...

#include <cl_FEM_Kernel.hpp>

Public Member Functions

 Kernel (KernelParameters *aKernelParameters)
 Collective: all ranks construct the kernel.
 ~Kernel ()
 Kernel (const Kernel &)=delete
 Kernel (Kernel &&)=delete
Kernel & operator= (const Kernel &)=delete
Kernel & operator= (Kernel &&)=delete
const KernelParameters * params ()
 The parameters are borrowed unless claim_parameter_ownership() was called.
DofManager * dofmgr (const uint aIndex=0)
 The dof manager at aIndex; owned by the kernel, never deleted by the caller.
Material * material (const string &aLabel)
 returns the material object registered under aLabel ( add_material ).
void add_material (const string aLabel, Material *aMaterial)
 manually add a material to the kernel.
void add_boundary_condition (PhysicalBoundaryCondition *aBC)
 manually add the BCs to the kernel.
Cell< PhysicalBoundaryCondition * > & boundary_conditions ()
 expose the boundary condition container
PhysicalBoundaryCondition * boundary_condition (id_t aID)
 expose a boundary condition for a specific sideset ID
void compute_boundary_conditions (real aTime)
 Computes the boundary conditions and updates the dofs at aTime.
const mesh::CommTable * comm_table (const uint aProc) const
 Borrowed: the kernel deletes the comm tables only when it built them itself, so the caller never deletes one.
const Cell< const mesh::CommTable * > & comm_tables () const
const proc_t & number_of_procs () const
const uint & field_offset () const
 returns the number of fields that existed before Kernel was created
Mesh * mesh ()
 The mesh on the master, the submesh on every other rank.
IWG * create_equation (const IwgType aEquationType, const ModelDimensionality aModelDimensionality=ModelDimensionality::UNDEFINED, const Vector< id_t > aBlocks={}, const Vector< id_t > aSideSets={})
 The kernel owns and destroys the returned equation; the caller only borrows it.
void add_equation (IWG *aEquation)
 special function to add an equation that has already been created.
DofManager * create_field (IWG *aEquation)
 Collective; it performs a barrier.
bool is_master () const
void claim_parameter_ownership (const bool aFlag=true)
 if this flag is set, the kernel will destroy the parameters
void claim_mesh_ownership (const bool aFlag=true)
 Hands the mesh the parameters point at over to this kernel, which then deletes it in its destructor.
void set_controller (Controller *aController)
 Borrowed and never deleted: the controller must outlive the kernel.
Controller * controller ()
bool has_controller () const
 true once set_controller() has attached a Controller; callers that may legitimately run without one ask this before calling controller()
void compute_element_volumes ()
 Collective: every rank must enter it.
uint number_of_dof_managers () const

Detailed Description

Top-level orchestrator.

Owns the equations, dof managers, materials and boundary conditions it creates or is handed. The mesh of the parameters is borrowed unless the factory that created it called claim_mesh_ownership(), as MaxwellFactory does; on the worker ranks the kernel owns the submesh it receives when it distributes the mesh itself, and borrows it from the parent kernel when chained onto one.

See also
FEM Kernel Module Documentation

Constructor & Destructor Documentation

◆ Kernel() [1/3]

belfem::fem::Kernel::Kernel ( KernelParameters * aKernelParameters)

Collective: all ranks construct the kernel.

It partitions the mesh on the master, distributes the submeshes, and barriers twice.

◆ ~Kernel()

belfem::fem::Kernel::~Kernel ( )

◆ Kernel() [2/3]

belfem::fem::Kernel::Kernel ( const Kernel & )
delete

◆ Kernel() [3/3]

belfem::fem::Kernel::Kernel ( Kernel && )
delete

Member Function Documentation

◆ add_boundary_condition()

void belfem::fem::Kernel::add_boundary_condition ( PhysicalBoundaryCondition * aBC)

manually add the BCs to the kernel.

The BC is now owned and destroyed by the kernel

◆ add_equation()

void belfem::fem::Kernel::add_equation ( IWG * aEquation)

special function to add an equation that has already been created.

The equation is now owned and destroyed by the kernel

◆ add_material()

void belfem::fem::Kernel::add_material ( const string aLabel,
Material * aMaterial )

manually add a material to the kernel.

The material is now owned and destroyed by the kernel

◆ boundary_condition()

PhysicalBoundaryCondition * belfem::fem::Kernel::boundary_condition ( id_t aID)
inline

expose a boundary condition for a specific sideset ID

◆ boundary_conditions()

Cell< PhysicalBoundaryCondition * > & belfem::fem::Kernel::boundary_conditions ( )
inline

expose the boundary condition container

Owned by the kernel; the container is a view.

◆ claim_mesh_ownership()

void belfem::fem::Kernel::claim_mesh_ownership ( const bool aFlag = true)

Hands the mesh the parameters point at over to this kernel, which then deletes it in its destructor.

Only the factory that created that mesh calls this; a kernel chained onto a parent borrows the parent's mesh and must not.

◆ claim_parameter_ownership()

void belfem::fem::Kernel::claim_parameter_ownership ( const bool aFlag = true)

if this flag is set, the kernel will destroy the parameters

◆ comm_table()

const mesh::CommTable * belfem::fem::Kernel::comm_table ( const uint aProc) const
inline

Borrowed: the kernel deletes the comm tables only when it built them itself, so the caller never deletes one.

◆ comm_tables()

const Cell< const mesh::CommTable * > & belfem::fem::Kernel::comm_tables ( ) const
inline

◆ compute_boundary_conditions()

void belfem::fem::Kernel::compute_boundary_conditions ( real aTime)

Computes the boundary conditions and updates the dofs at aTime.

aTime is the absolute simulation time [s].

◆ compute_element_volumes()

void belfem::fem::Kernel::compute_element_volumes ( )

Collective: every rank must enter it.

Measures every owned element into the hidden mesh field "_Volumes", exchanges the thin-shell areas, and aborts on the master if any volume is negative.

◆ controller()

Controller * belfem::fem::Kernel::controller ( )

◆ create_equation()

IWG * belfem::fem::Kernel::create_equation ( const IwgType aEquationType,
const ModelDimensionality aModelDimensionality = ModelDimensionality::UNDEFINED,
const Vector< id_t > aBlocks = {},
const Vector< id_t > aSideSets = {} )

The kernel owns and destroys the returned equation; the caller only borrows it.

◆ create_field()

DofManager * belfem::fem::Kernel::create_field ( IWG * aEquation)

Collective; it performs a barrier.

The kernel owns and destroys the returned dof manager. aEquation is linked, not adopted: pass it to the kernel through create_equation() or add_equation(), or it leaks.

◆ dofmgr()

DofManager * belfem::fem::Kernel::dofmgr ( const uint aIndex = 0)

The dof manager at aIndex; owned by the kernel, never deleted by the caller.

◆ field_offset()

const uint & belfem::fem::Kernel::field_offset ( ) const
inline

returns the number of fields that existed before Kernel was created

◆ has_controller()

bool belfem::fem::Kernel::has_controller ( ) const
inline

true once set_controller() has attached a Controller; callers that may legitimately run without one ask this before calling controller()

◆ is_master()

bool belfem::fem::Kernel::is_master ( ) const
inline

◆ material()

Material * belfem::fem::Kernel::material ( const string & aLabel)

returns the material object registered under aLabel ( add_material ).

Hard error if no such material exists. Called from Group::set_material( label )

◆ mesh()

Mesh * belfem::fem::Kernel::mesh ( )
inline

The mesh on the master, the submesh on every other rank.

Never deleted by the caller: the master's mesh belongs to this kernel once its factory handed it over ( claim_mesh_ownership ) and to its creator otherwise, a worker's submesh to this kernel or to the parent kernel it is chained onto ( see the class brief ).

◆ number_of_dof_managers()

uint belfem::fem::Kernel::number_of_dof_managers ( ) const
inline

◆ number_of_procs()

const proc_t & belfem::fem::Kernel::number_of_procs ( ) const
inline

◆ operator=() [1/2]

Kernel & belfem::fem::Kernel::operator= ( const Kernel & )
delete

◆ operator=() [2/2]

Kernel & belfem::fem::Kernel::operator= ( Kernel && )
delete

◆ params()

const KernelParameters * belfem::fem::Kernel::params ( )

The parameters are borrowed unless claim_parameter_ownership() was called.

◆ set_controller()

void belfem::fem::Kernel::set_controller ( Controller * aController)

Borrowed and never deleted: the controller must outlive the kernel.


The documentation for this class was generated from the following files: