suanPan
đź§® An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
ConditionalModifier Class Referenceabstract

Abstract base for node/element-scoped, step-conditional modifiers (constraints and loads). More...

#include <ConditionalModifier.h>

Inheritance diagram for ConditionalModifier:
Collaboration diagram for ConditionalModifier:

Public Member Functions

 ConditionalModifier (unsigned, unsigned, std::vector< Node::DOF > &&, std::vector< Node::DOF > &&)
 
virtual int initialize (const shared_ptr< DomainBase > &)
 
virtual int process (const shared_ptr< DomainBase > &)=0
 Process and update both stiffness and resistance.
 
virtual int process_resistance (const shared_ptr< DomainBase > &)
 Process and update resistance.
 
virtual void stage (const shared_ptr< DomainBase > &)
 Some algorithms need to manually modify some variables after solving.
 
std::set< uword > get_involving_nodes (const shared_ptr< DomainBase > &) const
 Return a set of all nodes involved.
 
const uvecget_node_dof () const
 
void deinitialize ()
 
bool is_initialized () const
 
void set_start_step (unsigned)
 
unsigned get_start_step () const
 
void set_end_step (unsigned)
 
unsigned get_end_step () const
 
virtual bool is_connected () const
 Indicate if this modifier can be deemed as an element that needs to account for connectivity.
 
bool validate_step (const shared_ptr< DomainBase > &) const
 Validate itself against the current active step to see if itself needs to be applied.
 
virtual void update_status (const vec &)
 
virtual void clear_status ()
 
virtual void commit_status ()
 
virtual void reset_status ()
 
- Public Member Functions inherited from UniqueTag
 UniqueTag (const UniqueTag &)=delete
 
 UniqueTag (UniqueTag &&)=delete
 
UniqueTagoperator= (const UniqueTag &)=delete
 
UniqueTagoperator= (UniqueTag &&)=delete
 
 ~UniqueTag () override=default
 
 Tag (unsigned=0)
 
 Tag (const Tag &)=default
 
 Tag (Tag &&) noexcept=default
 
- Public Member Functions inherited from Tag
 Tag (unsigned=0)
 
 Tag (const Tag &)=default
 
 Tag (Tag &&) noexcept=default
 
Tagoperator= (const Tag &)=delete
 
Tagoperator= (Tag &&)=delete
 
virtual ~Tag ()=default
 
void set_tag (unsigned) const
 
unsigned get_tag () const
 
void enable ()
 
void disable ()
 
void guard ()
 
void unguard ()
 
bool is_active () const
 
bool is_guarded () const
 
virtual void print ()
 

Protected Member Functions

double get_amplitude (const shared_ptr< DomainBase > &) const
 
const std::vector< Node::DOF > & get_dof_component () const
 Return the DoF components, falls back to the DoF order.
 
bool validate_node (const shared_ptr< DomainBase > &) const
 
bool validate_element (const shared_ptr< DomainBase > &) const
 
uvec collect_node_dof (const shared_ptr< DomainBase > &) const
 

Protected Attributes

unsigned start_step {1u}
 
unsigned end_step {static_cast<unsigned>(-1)}
 
const std::vector< Node::DOFdof_order
 
uvec target_node
 
uvec target_element
 
uvec target_dof
 

Detailed Description

Abstract base for node/element-scoped, step-conditional modifiers (constraints and loads).

Design intent

  • Provide a unified interface for objects that conditionally modify the global system (stiffness, resistance, external loads, settlements) over analysis steps.
  • Decouple addressing (nodes/elements/DOFs) from the concrete behavior implemented by derived classes.
  • Standardize life-cycle, amplitude handling, and step gating across loads and constraints.

Targeting and DOFs

  • Targets are given via tag lists: target_node and target_element.
  • DOF intent is specified by:
    • dof_order: exact DOF layout required by the target (used for validation when non-empty).
    • dof_component: unordered subset of DOFs to act upon (falls back to dof_order when empty).
  • Collected global DOF indices are cached in target_node_dof and target_element_dof:
    • collect_node_dof(): from addressed nodes.
    • collect_element_dof(): from nodes connected to addressed elements.

Validation

  • Derived classes opt-in to validation via validate_node() / validate_element().
  • validate_node_impl()/validate_element_impl() ensure targets exist, are active, and match dof_order exactly when dof_order is provided.

Amplitude handling

Step gating

  • start_step and end_step bound the active interval [start_step, end_step) for this modifier.
  • validate_step() checks if the modifier is active in the current step and itself is active.
  • Derived classes may adjust these (e.g., displacement-control loads limit to one step).

Life-cycle

  • Construction: record tags and DOF intent.
  • initialize(): 1) resolve amplitude and set start time, 2) optional node/element layout validation, 3) collect and cache target DOFs, 4) mark as initialized.
  • process(): pure virtual; derived classes assemble stiffness/resistance/loads/settlements.
  • process_resistance(): defaults to process(); override to avoid touching stiffness when required by algorithms.
  • stage(): pre-commit hook for predictor–corrector style updates (e.g., restitution).
  • deinitialize()/is_initialized(): manage lifetime and reusability.

Connectivity and queries

  • is_connected(): whether this modifier should be treated as an “element” for bandwidth/RCM; default false.
  • get_involving_nodes(): union of explicitly targeted nodes and nodes connected by targeted elements.
  • get_node_dof(): expose collected node DOFs.

State hooks for advanced constraints

Usage in derived classes

Group targeting

  • GroupModifier translates group tags to concrete node/element tags (DomainBase::flatten_group), allowing group-based derived classes to reuse the same initialization and DOF collection logic.

Concurrency and storage

  • ConditionalModifier itself is storage-agnostic; derived classes acquire Factory mutexes when modifying global matrices/vectors under full/sparse schemes.
Author
tlc
Date
07/03/2021
Version
0.1.0

Constructor & Destructor Documentation

◆ ConditionalModifier()

ConditionalModifier::ConditionalModifier ( unsigned  T,
unsigned  AT,
std::vector< Node::DOF > &&  DO,
std::vector< Node::DOF > &&  DC 
)

Member Function Documentation

◆ clear_status()

virtual void ConditionalModifier::clear_status ( )
inlinevirtual

◆ collect_node_dof()

uvec ConditionalModifier::collect_node_dof ( const shared_ptr< DomainBase > &  D) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ commit_status()

virtual void ConditionalModifier::commit_status ( )
inlinevirtual

◆ deinitialize()

void ConditionalModifier::deinitialize ( )

◆ get_amplitude()

double ConditionalModifier::get_amplitude ( const shared_ptr< DomainBase > &  D) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_dof_component()

const std::vector< Node::DOF > & ConditionalModifier::get_dof_component ( ) const
protected

Return the DoF components, falls back to the DoF order.

When DoF order is given, DoF components can be omitted.

Here is the caller graph for this function:

◆ get_end_step()

unsigned ConditionalModifier::get_end_step ( ) const

◆ get_involving_nodes()

std::set< uword > ConditionalModifier::get_involving_nodes ( const shared_ptr< DomainBase > &  D) const

Return a set of all nodes involved.

Some may define the interaction between nodes and elements. The nodes connected by elements are also found and returned.

◆ get_node_dof()

const uvec & ConditionalModifier::get_node_dof ( ) const

◆ get_start_step()

unsigned ConditionalModifier::get_start_step ( ) const

◆ initialize()

int ConditionalModifier::initialize ( const shared_ptr< DomainBase > &  D)
virtual

Reimplemented in PenaltyBC, GroupPenaltyBC, MPC, NodeFacet, NodeLine, ParticleCollision, RestitutionWallPenalty, RigidWallMultiplier, RigidWallPenalty, GroupBodyForce, LineUDL, NodalAcceleration, NodalDisplacement, GroupNodalDisplacement, NodalForce, GroupNodalForce, ReferenceForce, SupportMotion, Embed< DIM >, FixedLength< DIM >, MolecularDynamics< DIM, ROTATION >, MolecularDynamics< 2u, false >, and MolecularDynamics< 3u, false >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_connected()

virtual bool ConditionalModifier::is_connected ( ) const
inlinevirtual

Indicate if this modifier can be deemed as an element that needs to account for connectivity.

Some constraints may modify global stiffness matrix so that it needs to be treated as an element which may affect bandwidth of banded storage. By calling this method, the RCM reordering algorithm will take this constraint into consideration. Make sure it is properly overridden in the derived classes.

Reimplemented in FixedLength< DIM >, NodeFacet, and NodeLine.

◆ is_initialized()

bool ConditionalModifier::is_initialized ( ) const

◆ process()

virtual int ConditionalModifier::process ( const shared_ptr< DomainBase > &  )
pure virtual

Process and update both stiffness and resistance.

This method provides all necessary pieces of typical constraints/loads required, including additional blocks in original global stiffness, border matrix resistance of multiplier, external loads.

Implemented in PenaltyBC, MultiplierBC, GroupPenaltyBC, GroupMultiplierBC, MPC, NodeFacet, NodeLine, ParticleCollision, RestitutionWallPenalty, RigidWallMultiplier, RigidWallPenalty, BodyForce, LineUDL, NodalAcceleration, NodalDisplacement, NodalForce, ReferenceForce, SupportDisplacement, SupportVelocity, SupportAcceleration, Embed< DIM >, FixedLength< DIM >, MaxForce< DIM >, MolecularDynamics< DIM, ROTATION >, MolecularDynamics< 2u, false >, and MolecularDynamics< 3u, false >.

Here is the caller graph for this function:

◆ process_resistance()

int ConditionalModifier::process_resistance ( const shared_ptr< DomainBase > &  D)
virtual

Process and update resistance.

For some algorithms, the global stiffness is formed only once in each substep. After calling solver, the storage may contain factorization. It is not correct to modify it in those algorithms. This method should provide updated constraint/load resistance but must not touch global stiffness.

Reimplemented in PenaltyBC, ParticleCollision, MolecularDynamics< DIM, ROTATION >, MolecularDynamics< 2u, false >, and MolecularDynamics< 3u, false >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_status()

virtual void ConditionalModifier::reset_status ( )
inlinevirtual

◆ set_end_step()

void ConditionalModifier::set_end_step ( unsigned  ST)
Here is the caller graph for this function:

◆ set_start_step()

void ConditionalModifier::set_start_step ( unsigned  ST)

◆ stage()

virtual void ConditionalModifier::stage ( const shared_ptr< DomainBase > &  )
inlinevirtual

Some algorithms need to manually modify some variables after solving.

Typical example is the predictor–corrector type algorithms. This method is called before committing trial status to perform necessary operations.

Reimplemented in RestitutionWallPenalty.

◆ update_status()

virtual void ConditionalModifier::update_status ( const vec &  )
inlinevirtual

Reimplemented in NodeFacet, NodeLine, and FixedLength< DIM >.

◆ validate_element()

bool ConditionalModifier::validate_element ( const shared_ptr< DomainBase > &  D) const
protected
Here is the caller graph for this function:

◆ validate_node()

bool ConditionalModifier::validate_node ( const shared_ptr< DomainBase > &  D) const
protected
Here is the caller graph for this function:

◆ validate_step()

bool ConditionalModifier::validate_step ( const shared_ptr< DomainBase > &  D) const

Validate itself against the current active step to see if itself needs to be applied.

Here is the call graph for this function:

Member Data Documentation

◆ dof_order

const std::vector<Node::DOF> ConditionalModifier::dof_order
protected

◆ end_step

unsigned ConditionalModifier::end_step {static_cast<unsigned>(-1)}
protected

◆ start_step

unsigned ConditionalModifier::start_step {1u}
protected

◆ target_dof

uvec ConditionalModifier::target_dof
protected

◆ target_element

uvec ConditionalModifier::target_element
protected

◆ target_node

uvec ConditionalModifier::target_node
protected

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