Seismo-VLAB  1.3
An Open-Source Finite Element Software for Meso-Scale Simulations
Mesh.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // Seismo Virtual Laboratory
4 // Module for Serial and Parallel Analysis of seismic
5 // wave propagation and soil-structure interaction simulation
6 // Copyright (C) 2018-2021, The California Institute of Technology
7 // All Rights Reserved.
8 //
9 // Commercial use of this program without express permission of the California
10 // Institute of Technology, is strictly prohibited. See file "COPYRIGHT" in
11 // main directory for information on usage and redistribution, and for a
12 // DISCLAIMER OF ALL WARRANTIES.
13 //
14 //==============================================================================
15 //
16 // Written by:
17 // Danilo S. Kusanovic (dkusanov@caltech.edu)
18 // Elnaz E. Seylabi (elnaze@unr.edu)
19 //
20 // Supervised by:
21 // Domniki M. Asimaki (domniki@caltech.edu)
22 //
23 // References :
24 // [1]
25 //
26 // Description:
30 //------------------------------------------------------------------------------
31 
32 #ifndef _MESH_HPP_
33 #define _MESH_HPP_
34 
35 #include <map>
36 #include <vector>
37 #include <memory>
38 #include <Eigen/SparseCore>
39 
40 #include "Node.hpp"
41 #include "Load.hpp"
42 #include "Section.hpp"
43 #include "Material.hpp"
44 #include "Damping.hpp"
45 #include "Element.hpp"
46 #include "Constraint.hpp"
47 
55 class Mesh{
56 
57  public:
60  Mesh();
61 
63  ~Mesh();
64 
66  void Initialize();
67 
72  void AddNode(unsigned int tag, std::shared_ptr<Node> &node);
73 
78  void AddConstraint(unsigned int tag, std::shared_ptr<Constraint> &constraint);
79 
84  void AddFiber(unsigned int tag, std::unique_ptr<Material> &fiber);
85 
90  void AddMaterial(unsigned int tag, std::unique_ptr<Material> &material);
91 
96  void AddSection(unsigned int tag, std::unique_ptr<Section> &section);
97 
102  void AddDamping(unsigned int tag, std::shared_ptr<Damping> &damping);
103 
108  void AddElement(unsigned int tag, std::shared_ptr<Element> &element);
109 
114  void AddLoad(unsigned int tag, std::shared_ptr<Load> &load);
115 
120  void AddMass(unsigned int tag, Eigen::VectorXd& mass);
121 
125  void DelNode(unsigned int tag);
126 
130  void DelMass(unsigned int tag);
131 
135  void DelSupportMotion(unsigned int tag);
136 
140  void DelConstraint(int tag);
141 
145  void DelMaterial(unsigned int tag);
146 
150  void DelSection(unsigned int tag);
151 
155  void DelElement(unsigned int tag);
156 
157  //Remove a Damping from Mesh.
160  void DelDamping(unsigned int tag);
161 
165  void DelLoad(unsigned int tag);
166 
171  void SetDamping(unsigned int tag, std::vector<unsigned int> &group);
172 
178  void SetInitialCondition(unsigned int tag, int cond, Eigen::VectorXd& Xo);
179 
185  void SetSupportMotion(unsigned int tag, unsigned int dof, std::vector<double>& Xo);
186 
192  std::unique_ptr<Material>& GetMaterial(unsigned int tag);
193 
199  std::unique_ptr<Section>& GetSection(unsigned int tag);
200 
206  std::shared_ptr<Damping>& GetDamping(unsigned int tag);
207 
212  std::map<unsigned int, std::shared_ptr<Node> >& GetNodes();
213 
218  std::map<int, std::shared_ptr<Constraint> >& GetConstraints();
219 
224  std::map<unsigned int, std::shared_ptr<Element> >& GetElements();
225 
230  std::map<unsigned int, std::shared_ptr<Damping> >& GetDampings();
231 
236  std::map<unsigned int, std::shared_ptr<Load> >& GetLoads();
237 
241  template<typename T> std::vector<T> GetVectorIDs(std::string Name);
242 
247  Eigen::SparseMatrix<double> GetTotalToFreeMatrix();
248 
249  protected:
251  std::map<unsigned int, std::shared_ptr<Node> > Nodes;
252 
254  std::map<int, std::shared_ptr<Constraint> > Constraints;
255 
257  std::map<unsigned int, std::unique_ptr<Material> > Materials;
258 
260  std::map<unsigned int, std::unique_ptr<Section> > Sections;
261 
263  std::map<unsigned int, std::shared_ptr<Damping> > Dampings;
264 
266  std::map<unsigned int, std::shared_ptr<Element> > Elements;
267 
269  std::map<unsigned int, std::shared_ptr<Load> > Loads;
270 };
271 
272 #endif
std::map< unsigned int, std::shared_ptr< Node > > Nodes
Container/map of nodes for this partition.
Definition: Mesh.hpp:251
void DelSection(unsigned int tag)
Remove a Section from Mesh.
void AddSection(unsigned int tag, std::unique_ptr< Section > &section)
Add a Section to the Mesh.
void DelDamping(unsigned int tag)
This file contains the "Constraint object" declarations, which impose linear kinematic relations betw...
void DelConstraint(int tag)
Remove a Constraint from Mesh.
std::map< unsigned int, std::shared_ptr< Damping > > Dampings
Container/map of damping for this partition.
Definition: Mesh.hpp:263
This file contains the "Load" class declarations, which defines a load that can act in a node or an e...
std::unique_ptr< Material > & GetMaterial(unsigned int tag)
Gets a material from the mesh.
void AddConstraint(unsigned int tag, std::shared_ptr< Constraint > &constraint)
Add a Constraint to the Mesh.
void DelNode(unsigned int tag)
Remove a Node from Mesh.
std::vector< T > GetVectorIDs(std::string Name)
Returns a vector with identifier of the property requested.
std::map< unsigned int, std::shared_ptr< Load > > Loads
Container/map of loads for this partition.
Definition: Mesh.hpp:269
void AddElement(unsigned int tag, std::shared_ptr< Element > &element)
Add a Element to the Mesh.
void DelLoad(unsigned int tag)
Remove a Load from Mesh.
void AddMaterial(unsigned int tag, std::unique_ptr< Material > &material)
Add a Material to the Mesh.
This file contains the abstract "Material object" declarations, which computes the strain...
Class for defining a mesh that stores the nodes, materials, elements, and loads.
Definition: Mesh.hpp:55
std::map< unsigned int, std::shared_ptr< Element > > Elements
Container/map of elements for this partition.
Definition: Mesh.hpp:266
void SetInitialCondition(unsigned int tag, int cond, Eigen::VectorXd &Xo)
Specifies the Node initial condition.
This file contains the abstract "Section object" declarations, which computes the strain...
void AddMass(unsigned int tag, Eigen::VectorXd &mass)
Add a point mass to a Node.
void SetSupportMotion(unsigned int tag, unsigned int dof, std::vector< double > &Xo)
Specifies the support motion for a certain Node object.
Eigen::SparseMatrix< double > GetTotalToFreeMatrix()
Gets operator that impose restrains/constraints on the model.
std::map< int, std::shared_ptr< Constraint > > Constraints
Container/map of constraints for this partition.
Definition: Mesh.hpp:254
std::map< unsigned int, std::shared_ptr< Damping > > & GetDampings()
Gets all damping from the mesh.
void AddNode(unsigned int tag, std::shared_ptr< Node > &node)
Add a Node object to the Mesh.
void DelSupportMotion(unsigned int tag)
Remove the support motions associated to Node in from Mesh.
std::unique_ptr< Section > & GetSection(unsigned int tag)
Gets a section from the mesh.
std::shared_ptr< Damping > & GetDamping(unsigned int tag)
Gets damping from the mesh.
void AddDamping(unsigned int tag, std::shared_ptr< Damping > &damping)
Add a Damping model to the Mesh.
void AddLoad(unsigned int tag, std::shared_ptr< Load > &load)
Add a Load to the Mesh.
std::map< unsigned int, std::unique_ptr< Material > > Materials
Container/map of materials for this partition.
Definition: Mesh.hpp:257
void Initialize()
Initialize the Mesh and compute memory storage.
void DelElement(unsigned int tag)
Remove an Element from Mesh.
This file contains the "Node object" declarations, which is stores the coordinates, state variables, degrees-of-freedom, and total-degree of freedom lists of a node in a finite element mesh.
This file contains the "Damping object" declarations to update damping matrix to account for Caughey-...
std::map< int, std::shared_ptr< Constraint > > & GetConstraints()
Gets constraint from the mesh.
std::map< unsigned int, std::shared_ptr< Node > > & GetNodes()
Gets nodes from the mesh.
void SetDamping(unsigned int tag, std::vector< unsigned int > &group)
Add a Damping model to the Mesh.
std::map< unsigned int, std::shared_ptr< Load > > & GetLoads()
Gets loads from the mesh.
std::map< unsigned int, std::shared_ptr< Element > > & GetElements()
Gets elements from the mesh.
Mesh()
Creates a Mesh object (container) to store Node, Material, Element, Load.
void AddFiber(unsigned int tag, std::unique_ptr< Material > &fiber)
Add a Material to the Mesh.
void DelMass(unsigned int tag)
Remove a Point Mass from Mesh.
void DelMaterial(unsigned int tag)
Remove a Material from Mesh.
~Mesh()
Destroys this Mesh object.
This file contains the "Element" object declarations, which defines an element in a finite element me...
std::map< unsigned int, std::unique_ptr< Section > > Sections
Container/map of materials for this partition.
Definition: Mesh.hpp:260