|
OpenBeam
C++ library for static analysis of mechanical structures
|
#include <CFiniteElementProblem.h>

Classes | |
| struct | node_used_t |
| struct | TNodeElementConnection |
| struct | TProblemDOFIndicesForNode |
Public Types | |
| using | constraint_list_t = std::map< size_t, num_t > |
| using | load_list_t = std::map< size_t, num_t > |
Public Member Functions | |
High-level management | |
| virtual void | clear () |
| bool | loadFromStream (std::istream &is, const mrpt::optional_ref< vector_string_t > &errMsg=std::nullopt, const mrpt::optional_ref< vector_string_t > &warnMsg=std::nullopt) |
| bool | loadFromFile (const std::string &file, const mrpt::optional_ref< vector_string_t > &errMsg=std::nullopt, const mrpt::optional_ref< vector_string_t > &warnMsg=std::nullopt) |
| bool | saveAsImageSVG (const std::string &file, const DrawStructureOptions &options, const StaticSolveProblemInfo *solver_info=nullptr, const MeshOutputInfo *meshing_info=nullptr, ImageSaveOutputInfo *out_img_info=nullptr) const |
| bool | saveAsImagePNG (const std::string &file, const DrawStructureOptions &options, const StaticSolveProblemInfo *solver_info=nullptr, const MeshOutputInfo *meshing_info=nullptr, ImageSaveOutputInfo *out_img_info=nullptr) const |
| bool | saveAsImage (const std::string &file, const bool is_svg, const DrawStructureOptions &options, const StaticSolveProblemInfo *solver_info=nullptr, const MeshOutputInfo *meshing_info=nullptr, ImageSaveOutputInfo *out_img_info=nullptr) const |
| bool | renderToCairoContext (void *_cairo_context, const RenderInitData &ri, const DrawStructureOptions &options, const StaticSolveProblemInfo *solver_info, const MeshOutputInfo *meshing_info) const |
| mrpt::opengl::CSetOfObjects::Ptr | getVisualization (const DrawStructureOptions &options, const StaticSolveProblemInfo &solver_info, const MeshOutputInfo *meshing_info=nullptr, const StressInfo *stressInfo=nullptr) const |
Problem elements | |
| size_t | insertElement (CElement::Ptr el) |
| template<typename ElementClass , typename... _Args> | |
| size_t | createElement (_Args &&... __args) |
| CElement::ConstPtr | getElement (size_t i) const |
| const CElement::Ptr & | getElement (size_t i) |
| size_t | getNumberOfElements () const |
Problem constraints | |
| void | insertConstraint (const size_t dof_index, const num_t value=0) |
| const constraint_list_t & | getAllConstraints () const |
| void | setLoadAtDOF (const size_t dof_index, const num_t f) |
| void | addLoadAtDOF (const size_t dof_index, const num_t f) |
| const load_list_t & | getOverallLoadsOnDOFs () const |
Problem nodes and their reference 3D pose (to this, one must add | |
the displacement obtained as solution to the problem). | |
| void | setNumberOfNodes (size_t N) |
| size_t | getNumberOfNodes () const |
| node_index_t | insertNode (const TRotationTrans3D &p) |
| void | setNodePose (size_t idx, const TRotationTrans3D &p) |
| void | setNodePose (size_t idx, const num_t x, const num_t y, const num_t z) |
| TRotationTrans3D & | getNodePose (size_t i) |
| const TRotationTrans3D & | getNodePose (size_t i) const |
| void | getNodeDeformedPosition (size_t i, Vector3 &out_final_point, const StaticSolveProblemInfo &solver_info, const num_t exageration_factor=1) const |
| num_t | getMaximumDeformedDisplacement (const StaticSolveProblemInfo &solver_info) const |
| void | getBoundingBox (num_t &min_x, num_t &max_x, num_t &min_y, num_t &max_y, bool deformed=false, const StaticSolveProblemInfo *solver_info=nullptr, num_t deformed_scale_factor=1.0) const |
Problem solving | |
| virtual void | updateAll () |
| void | assembleProblem (BuildProblemInfo &out_info) |
| void | solveStatic (StaticSolveProblemInfo &out_info, const StaticSolverOptions &opts=StaticSolverOptions()) |
| void | postProcCalcStress (StressInfo &out_stress, const StaticSolveProblemInfo &solver_info) |
| std::string | getNodeLabel (const size_t idx) const |
| "N%i" or custom label | |
Protected Types | |
| using | TNodeConnections = std::map< element_index_t, TNodeElementConnection > |
Protected Member Functions | |
| virtual void | internalComputeStressAndEquivalentLoads () |
| bool | internal_loadFromYaml (const mrpt::containers::yaml &f, const mrpt::optional_ref< vector_string_t > &errMsg, const mrpt::optional_ref< vector_string_t > &warnMsg) |
| void | internal_parser1_Parameters (const mrpt::containers::yaml &f, EvaluationContext &ctx) const |
| void | internal_parser2_BeamSections (const mrpt::containers::yaml &f, EvaluationContext &ctx) const |
| void | internal_parser3_nodes (const mrpt::containers::yaml &f, EvaluationContext &ctx) |
| void | internal_parser4_elements (const mrpt::containers::yaml &f, EvaluationContext &ctx) |
| void | internal_parser5_constraints (const mrpt::containers::yaml &f, EvaluationContext &ctx) |
| void | internal_parser6_node_loads (const mrpt::containers::yaml &f, EvaluationContext &ctx) |
| void | internal_parser7_element_loads (const mrpt::containers::yaml &f, EvaluationContext &ctx) |
| void | updateListDoFs () |
| void | updateNodeConnections () |
| void | updateElementsOrientation () |
| void | updateNodesMainOrientation () |
| void | internal_getVisualization_nodeLoads (mrpt::opengl::CSetOfObjects &gl, const DrawStructureOptions &options, const StaticSolveProblemInfo &solver_info, const MeshOutputInfo *meshing_info, num_t DEFORMED_SCALE_FACTOR) const |
| void | internal_getVisualization_constraints (mrpt::opengl::CSetOfObjects &gl, const DrawStructureOptions &options, const StaticSolveProblemInfo &solver_info, const MeshOutputInfo *meshing_info, num_t DEFORMED_SCALE_FACTOR) const |
| void | internal_getVisualization_distributedLoads (const CStructureProblem &str, mrpt::opengl::CSetOfObjects &gl, const DrawStructureOptions &options, const StaticSolveProblemInfo &solver_info, const MeshOutputInfo *meshing_info, num_t DEFORMED_SCALE_FACTOR) const |
| void | internal_getVisualization_stressDiagrams (mrpt::opengl::CSetOfObjects &gl, const DrawStructureOptions &options, const StaticSolveProblemInfo &solverInfo, const MeshOutputInfo *meshingInfo, num_t DEFORMED_SCALE_FACTOR, const StressInfo &stressInfo) const |
Protected Attributes | |
| std::vector< NodeDoF > | m_problem_DoFs |
| std::vector< TProblemDOFIndicesForNode > | m_problem_DoFs_inverse_list |
| std::vector< TNodeConnections > | m_node_connections |
| std::vector< TRotation3D > | m_nodeMainDirection |
Main data | |
| std::deque< node_used_t > | m_node_defined |
| std::deque< TRotationTrans3D > | m_node_poses |
| std::vector< std::string > | m_node_labels |
| node custom label | |
| std::deque< CElement::Ptr > | m_elements |
| constraint_list_t | m_DoF_constraints |
| load_list_t | m_loads_at_each_dof |
| load_list_t | m_loads_at_each_dof_equivs |
| std::map< size_t, ElementStress > | m_extra_stress_for_each_element |
Problem DOFs (abstract list of DoF, doesn't have quantitative | |
| const std::vector< NodeDoF > & | getProblemDoFs () |
| std::string | getProblemDoFsDescription () |
| size_t | getDOFIndex (const size_t nNode, const DoF_index n) const |
| static std::vector< size_t > | complementaryDoFs (const std::vector< size_t > &ds, const size_t nTotalDOFs) |
A complete problem of finite elements. It contains:
|
protected |
For each node, this map has the list of connected elements and the type of the connection.
| void openbeam::CFiniteElementProblem::addLoadAtDOF | ( | const size_t | dof_index, |
| const num_t | f | ||
| ) |
Adds a load (force or moment) to a given DOF, accumulating to previously existing values if any.
| void openbeam::CFiniteElementProblem::assembleProblem | ( | BuildProblemInfo & | out_info | ) |
For any partitioning of the DoFs into fixed (restricted, boundary conditions) and the rest (the free variables free_dof_indices), where DoF indices refer to m_problem_DoFs, computes three sparse matrices: K_{FF} (free-free), K_{BB} (boundary-boundary) and K_{BF} (boundary-free) which define the stiffness matrix of the problem.
|
virtual |
Delete all elements, nodes and constraints in this problem, completely emptying it.
Reimplemented in openbeam::CStructureProblem.
|
static |
Return the complementary list of DOFs, such as "return \CUP ds = 1:N" and "return \CAP ds = \empty".
|
inline |
Insert a new element in the problem
| void openbeam::CFiniteElementProblem::getBoundingBox | ( | num_t & | min_x, |
| num_t & | max_x, | ||
| num_t & | min_y, | ||
| num_t & | max_y, | ||
| bool | deformed = false, |
||
| const StaticSolveProblemInfo * | solver_info = nullptr, |
||
| num_t | deformed_scale_factor = 1.0 |
||
| ) | const |
Computes the bounding box of all existing nodes
| size_t openbeam::CFiniteElementProblem::getDOFIndex | ( | const size_t | nNode, |
| const DoF_index | n | ||
| ) | const |
Returns the 0-based index of the n'th DOF (0-5) of node "nNode" in the list of DOFs to consider in the problem. Callable only after buildAll(). Returns string::npos if the DOF is NOT considered in the problem.
| const CElement::Ptr& openbeam::CFiniteElementProblem::getElement | ( | size_t | i | ) |
Return a pointer to the i'th element in the problem.
| CElement::ConstPtr openbeam::CFiniteElementProblem::getElement | ( | size_t | i | ) | const |
Return a constant pointer to the i'th element in the problem.
| num_t openbeam::CFiniteElementProblem::getMaximumDeformedDisplacement | ( | const StaticSolveProblemInfo & | solver_info | ) | const |
Returns the maximum absolute value translation in any X,Y,Z directions for a static problem solution
| void openbeam::CFiniteElementProblem::getNodeDeformedPosition | ( | size_t | i, |
| Vector3 & | out_final_point, | ||
| const StaticSolveProblemInfo & | solver_info, | ||
| const num_t | exageration_factor = 1 |
||
| ) | const |
Returns the 3D location of the final deformed state after solving the problem
|
inline |
The 3D location of a node; its orientation (if different than global coordinates) serves as a local frame for constraints.
|
inline |
The 3D location of a node; its orientation (if different than global coordinates) serves as a local frame for constraints.
|
inline |
Get the number of elements in the problem
|
inline |
Number of DoF's?
|
inline |
Return the list of all DoF in the problem .
| std::string openbeam::CFiniteElementProblem::getProblemDoFsDescription | ( | ) |
Make a list with all DoF in the problem sorted by nodes.
| void openbeam::CFiniteElementProblem::insertConstraint | ( | const size_t | dof_index, |
| const num_t | value = 0 |
||
| ) |
Adds a new displacement constraint to the problem, at the DoF dof_index (indices wrt list returned by getProblemDoFs() ).
| size_t openbeam::CFiniteElementProblem::insertElement | ( | CElement::Ptr | el | ) |
Insert a new element in the problem
| node_index_t openbeam::CFiniteElementProblem::insertNode | ( | const TRotationTrans3D & | p | ) |
Insert a new node to the problem with the given 6D pose, in global coordinates.
|
protected |
Internal common implementation of loadFrom*() methods()
|
inlineprotectedvirtual |
In base classes, process loads on elements and populate the m_loads_at_each_dof_equivs and m_extra_stress_for_each_element
| bool openbeam::CFiniteElementProblem::loadFromFile | ( | const std::string & | file, |
| const mrpt::optional_ref< vector_string_t > & | errMsg = std::nullopt, |
||
| const mrpt::optional_ref< vector_string_t > & | warnMsg = std::nullopt |
||
| ) |
Discard the current problem and loads it by parsing the given text file. The expected format of the file is described in XXXX.
| [in] | is | The input stream. |
| [out] | errMsg | The error messages found while parsing the text. |
| [out] | warnMsg | The warning messages found while parsing the text. |
| bool openbeam::CFiniteElementProblem::loadFromStream | ( | std::istream & | is, |
| const mrpt::optional_ref< vector_string_t > & | errMsg = std::nullopt, |
||
| const mrpt::optional_ref< vector_string_t > & | warnMsg = std::nullopt |
||
| ) |
Discard the current problem and loads it by parsing the given text input stream. The expected format of the file is described in XXXX.
| [in] | is | The input stream. |
| [out] | errMsg | The error messages found while parsing the text. |
| [out] | warnMsg | The warning messages found while parsing the text. |
| void openbeam::CFiniteElementProblem::postProcCalcStress | ( | StressInfo & | out_stress, |
| const StaticSolveProblemInfo & | solver_info | ||
| ) |
After solving the problem with solveStatic, you can optionally call this post-processing method to evaluate the stress of all the elements.
| bool openbeam::CFiniteElementProblem::saveAsImageSVG | ( | const std::string & | file, |
| const DrawStructureOptions & | options, | ||
| const StaticSolveProblemInfo * | solver_info = nullptr, |
||
| const MeshOutputInfo * | meshing_info = nullptr, |
||
| ImageSaveOutputInfo * | out_img_info = nullptr |
||
| ) | const |
Saves a representation of the problem to a SVG file.
| options | Many parameters and switches to control what will be drawn and hiden. |
| void openbeam::CFiniteElementProblem::setLoadAtDOF | ( | const size_t | dof_index, |
| const num_t | f | ||
| ) |
Sets the load (force or moment) applied to a given DOF
| void openbeam::CFiniteElementProblem::setNodePose | ( | size_t | idx, |
| const num_t | x, | ||
| const num_t | y, | ||
| const num_t | z | ||
| ) |
Set the reference 3D pose of a node, in global coordinates
| void openbeam::CFiniteElementProblem::setNodePose | ( | size_t | idx, |
| const TRotationTrans3D & | p | ||
| ) |
Set the reference 6D pose of a node, in global coordinates
| void openbeam::CFiniteElementProblem::setNumberOfNodes | ( | size_t | N | ) |
Set the number of nodes in the problem
| void openbeam::CFiniteElementProblem::solveStatic | ( | StaticSolveProblemInfo & | out_info, |
| const StaticSolverOptions & | opts = StaticSolverOptions() |
||
| ) |
Solve the static FE problem, returning the resulting displacements and reaction forces.
|
virtual |
Update all internal lists after changing the problem. This actually calls:
Reimplemented in openbeam::CStructureProblem.
|
protected |
Call the "updateOrientationFromNodePositions" in each element
|
protected |
From the list of elements and their properties and connections, build the list of DoFs relevant to the problem.
|
protected |
From the list of elements, update m_node_connections
|
protected |
Fills up m_nodeMainDirection
|
protected |
List of constrainsts for each "fixed/constrained" DoF. Map key are indices in m_problem_DoFs. Map values are displacement in that DoF wrt the current node pose. Units are SI (meters or radians).
|
protected |
The extra stress to add up to each element as computed by internalComputeStressAndEquivalentLoads map: element index -> vector for each "port" -> vector of 6 stresses values.
|
protected |
The vector of overall external loads (F_L) - Map keys are indices of m_problem_DoFs
|
protected |
The vector of overall loads (F_L') on each DoF due to distributed forces - Map keys are indices of m_problem_DoFs Updated by assembleProblem() via internalComputeStressAndEquivalentLoads()
|
protected |
A vector with an item for each node (list in m_node_poses) Each item is a map from element_id -> TNodeElementConnection Length=number of nodes.
|
protected |
For each node, the +X direction of the first element touching that node. Filled by updateNodesMainOrientation()
|
protected |
The list of DoFs variables of my problem. Built by updateListDoFs()
|
protected |
Built together with m_problem_DoFs by updateListDoFs , holds the mapping from node index -> 6 numbers, with the index of that global DOF in the list of problem DOFs, or -1 if the DOF is not considered.