Abstract base for node/element-scoped, step-conditional modifiers (constraints and loads).
More...
#include <ConditionalModifier.h>
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
- Loads (e.g., NodalForce, NodalDisplacement/SupportMotion, BodyForce, LineUDL, NodalAcceleration, ReferenceForce) employ get_amplitude() and collected DOFs to assemble trial_load, trial_settlement, or reference_load.
- Constraints (e.g., BC, FixedLength, NodeLine/Facet, Embed, ParticleCollision, Rigid/RestitutionWallPenalty, MPC) use collected DOFs to assemble resistance/stiffness and optional auxiliary blocks.
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
◆ ConditionalModifier()
| ConditionalModifier::ConditionalModifier |
( |
unsigned |
T, |
|
|
unsigned |
AT, |
|
|
std::vector< Node::DOF > && |
DO, |
|
|
std::vector< Node::DOF > && |
DC |
|
) |
| |
◆ clear_status()
| virtual void ConditionalModifier::clear_status |
( |
| ) |
|
|
inlinevirtual |
◆ collect_node_dof()
| uvec ConditionalModifier::collect_node_dof |
( |
const shared_ptr< DomainBase > & |
D | ) |
const |
|
protected |
◆ 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 |
◆ 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.
◆ 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 >.
◆ 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 >.
◆ process_resistance()
| int ConditionalModifier::process_resistance |
( |
const shared_ptr< DomainBase > & |
D | ) |
|
|
virtual |
◆ reset_status()
| virtual void ConditionalModifier::reset_status |
( |
| ) |
|
|
inlinevirtual |
◆ set_end_step()
| void ConditionalModifier::set_end_step |
( |
unsigned |
ST | ) |
|
◆ 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 |
◆ validate_element()
| bool ConditionalModifier::validate_element |
( |
const shared_ptr< DomainBase > & |
D | ) |
const |
|
protected |
◆ validate_node()
| bool ConditionalModifier::validate_node |
( |
const shared_ptr< DomainBase > & |
D | ) |
const |
|
protected |
◆ 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.
◆ 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: