NEML2 2.1.0
Loading...
Searching...
No Matches

Definition of a linear system of equations, Au = b. More...

Detailed Description

Definition of a linear system of equations, Au = b.

#include <LinearSystem.h>

Inheritance diagram for LinearSystem:

Public Member Functions

 LinearSystem ()=default
 LinearSystem (const LinearSystem &)=default
 LinearSystem (LinearSystem &&) noexcept=default
LinearSystemoperator= (const LinearSystem &)=default
LinearSystemoperator= (LinearSystem &&) noexcept=default
virtual ~LinearSystem ()=default
virtual void init ()
 Setup axis layouts.
virtual void set_u (const AssembledVector &)=0
 Set the unknown u.
virtual void set_g (const AssembledVector &)=0
 Set the given variables g from the current step.
virtual AssembledVector u () const =0
 Get the unknown u.
virtual AssembledVector g () const =0
 Get the given variables g from the current step.
virtual void u_changed ()
 Trigger when unknown variables changed.
virtual void g_changed ()
 Trigger when given variables changed.
AssembledMatrix A ()
 Assemble and return the operator, A.
AssembledVector b ()
 Assemble and return the right-hand side, b.
std::tuple< AssembledMatrix, AssembledVectorA_and_b ()
 Assemble and return the right-hand side and operator.
std::tuple< AssembledMatrix, AssembledMatrixA_and_B ()
 Assemble the auxiliary matrix B = dr/dg along with A.
std::tuple< AssembledMatrix, AssembledMatrix, AssembledVectorA_and_B_and_b ()
 Assemble the auxiliary matrix B = dr/dg along with A and b.
AxisLayout ulayout () const
 Get the unknown-variable layout.
AxisLayout glayout () const
 Get the given-variable layout.
AxisLayout blayout () const
 Get the RHS variable layout.

Protected Member Functions

virtual std::shared_ptr< AxisLayoutsetup_ulayout ()=0
 Setup the unknown layout, partitioned by variable group.
virtual std::shared_ptr< AxisLayoutsetup_glayout ()=0
 Setup the given variable layout.
virtual std::shared_ptr< AxisLayoutsetup_blayout ()=0
 Setup the RHS variable layout.
virtual void assemble (AssembledMatrix *A, AssembledMatrix *B, AssembledVector *b)=0
 Compute the operator and right-hand side.
virtual void pre_assemble (bool A, bool B, bool b)
 Callback before assembly to perform.
virtual void post_assemble (bool A, bool B, bool b)
 Callback after assembly to perform.

Protected Attributes

bool _A_up_to_date = false
 Flag indicating if the system matrix is up to date. Setters invalidate this.
bool _B_up_to_date = false
 Flag indicating if the auxiliary matrix is up to date. Setters invalidate this.
bool _b_up_to_date = false
 Flag indicating if the system RHS is up to date. Setters invalidate this.
std::shared_ptr< AxisLayout_ulayout
 Layout of unknowns, partitioned by variable groups.
std::shared_ptr< AxisLayout_glayout
 Layout of given variables.
std::shared_ptr< AxisLayout_blayout
 Layout of RHS variables, partitioned by variable groups.

Constructor & Destructor Documentation

◆ LinearSystem() [1/3]

LinearSystem ( )
default

◆ LinearSystem() [2/3]

LinearSystem ( const LinearSystem & )
default

◆ LinearSystem() [3/3]

LinearSystem ( LinearSystem && )
defaultnoexcept

◆ ~LinearSystem()

virtual ~LinearSystem ( )
virtualdefault

Member Function Documentation

◆ A()

Assemble and return the operator, A.

◆ A_and_B()

std::tuple< AssembledMatrix, AssembledMatrix > A_and_B ( )

Assemble the auxiliary matrix B = dr/dg along with A.

◆ A_and_b()

std::tuple< AssembledMatrix, AssembledVector > A_and_b ( )

Assemble and return the right-hand side and operator.

◆ A_and_B_and_b()

std::tuple< AssembledMatrix, AssembledMatrix, AssembledVector > A_and_B_and_b ( )

Assemble the auxiliary matrix B = dr/dg along with A and b.

◆ assemble()

virtual void assemble ( AssembledMatrix * A,
AssembledMatrix * B,
AssembledVector * b )
protectedpure virtual

Compute the operator and right-hand side.

Parameters
APointer to the operator matrix – nullptr if not requested
BPointer to the auxiliary matrix – nullptr if not requested
bPointer to the RHS vector – nullptr if not requested

Implemented in ModelNonlinearSystem.

◆ b()

Assemble and return the right-hand side, b.

◆ blayout()

AxisLayout blayout ( ) const

Get the RHS variable layout.

◆ g()

virtual AssembledVector g ( ) const
pure virtual

Get the given variables g from the current step.

Implemented in ModelNonlinearSystem.

◆ g_changed()

virtual void g_changed ( )
virtual

Trigger when given variables changed.

◆ glayout()

AxisLayout glayout ( ) const

Get the given-variable layout.

◆ init()

virtual void init ( )
virtual

Setup axis layouts.

◆ operator=() [1/2]

LinearSystem & operator= ( const LinearSystem & )
default

◆ operator=() [2/2]

LinearSystem & operator= ( LinearSystem && )
defaultnoexcept

◆ post_assemble()

virtual void post_assemble ( bool A,
bool B,
bool b )
protectedvirtual

Callback after assembly to perform.

This is useful, for example, to collect information that isn't available after the first assembly

Parameters
AWhether the operator matrix was assembled
BWhether the auxiliary matrix was assembled
bWhether the RHS vector was assembled

Reimplemented in ModelNonlinearSystem.

◆ pre_assemble()

virtual void pre_assemble ( bool A,
bool B,
bool b )
protectedvirtual

Callback before assembly to perform.

This is useful, for example, to clear obsolete data structures

Parameters
AWhether the operator matrix was assembled
BWhether the auxiliary matrix was assembled
bWhether the RHS vector was assembled

Reimplemented in ModelNonlinearSystem.

◆ set_g()

virtual void set_g ( const AssembledVector & )
pure virtual

Set the given variables g from the current step.

Implemented in ModelNonlinearSystem.

◆ set_u()

virtual void set_u ( const AssembledVector & )
pure virtual

Set the unknown u.

Implemented in ModelNonlinearSystem.

◆ setup_blayout()

virtual std::shared_ptr< AxisLayout > setup_blayout ( )
protectedpure virtual

Setup the RHS variable layout.

Implemented in ModelNonlinearSystem.

◆ setup_glayout()

virtual std::shared_ptr< AxisLayout > setup_glayout ( )
protectedpure virtual

Setup the given variable layout.

Implemented in ModelNonlinearSystem.

◆ setup_ulayout()

virtual std::shared_ptr< AxisLayout > setup_ulayout ( )
protectedpure virtual

Setup the unknown layout, partitioned by variable group.

Implemented in ModelNonlinearSystem.

◆ u()

virtual AssembledVector u ( ) const
pure virtual

Get the unknown u.

Implemented in ModelNonlinearSystem.

◆ u_changed()

virtual void u_changed ( )
virtual

Trigger when unknown variables changed.

Reimplemented in NonlinearSystem.

◆ ulayout()

AxisLayout ulayout ( ) const

Get the unknown-variable layout.

Member Data Documentation

◆ _A_up_to_date

bool _A_up_to_date = false
protected

Flag indicating if the system matrix is up to date. Setters invalidate this.

◆ _B_up_to_date

bool _B_up_to_date = false
protected

Flag indicating if the auxiliary matrix is up to date. Setters invalidate this.

◆ _b_up_to_date

bool _b_up_to_date = false
protected

Flag indicating if the system RHS is up to date. Setters invalidate this.

◆ _blayout

std::shared_ptr<AxisLayout> _blayout
protected

Layout of RHS variables, partitioned by variable groups.

◆ _glayout

std::shared_ptr<AxisLayout> _glayout
protected

Layout of given variables.

◆ _ulayout

std::shared_ptr<AxisLayout> _ulayout
protected

Layout of unknowns, partitioned by variable groups.