Seismo-VLAB  1.3
An Open-Source Finite Element Software for Meso-Scale Simulations
Driver.hpp File Reference

This file contains the "parsing" functions to create, modify and analyze a finite element model provided in JSON format. More...

#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <fstream>
#include <iostream>
#include <algorithm>
#include "Viscous1DLinear.hpp"
#include "Elastic1DLinear.hpp"
#include "Hertzian1DLinear.hpp"
#include "Elastic2DPlaneStress.hpp"
#include "Elastic2DPlaneStrain.hpp"
#include "PlasticPlaneStrainJ2.hpp"
#include "PlasticPlaneStrainBA.hpp"
#include "Elastic3DLinear.hpp"
#include "Plastic1DJ2.hpp"
#include "Plastic3DJ2.hpp"
#include "Plastic3DBA.hpp"
#include "Elastic1DGap.hpp"
#include "Plastic1DGap.hpp"
#include "Elastic1DFiber.hpp"
#include "Steel1DFiber.hpp"
#include "Concrete1DFiber.hpp"
#include "Lin2DRectangular.hpp"
#include "Lin3DRectangular.hpp"
#include "Lin2DAngle.hpp"
#include "Lin3DAngle.hpp"
#include "Lin2DChannel.hpp"
#include "Lin3DChannel.hpp"
#include "Lin2DTee.hpp"
#include "Lin3DTee.hpp"
#include "Lin2DWideFlange.hpp"
#include "Lin3DWideFlange.hpp"
#include "Lin2DCircular.hpp"
#include "Lin3DCircular.hpp"
#include "Lin2DRectangularTube.hpp"
#include "Lin3DRectangularTube.hpp"
#include "Lin2DCircularTube.hpp"
#include "Lin3DCircularTube.hpp"
#include "Lin3DThinArea.hpp"
#include "Lin2DUserDefined.hpp"
#include "Lin3DUserDefined.hpp"
#include "Fib3DLineSection.hpp"
#include "ZeroLength1D.hpp"
#include "lin2DTruss2.hpp"
#include "kin2DTruss2.hpp"
#include "lin3DTruss2.hpp"
#include "kin3DTruss2.hpp"
#include "lin2DTruss3.hpp"
#include "lin3DTruss3.hpp"
#include "lin2DFrame2.hpp"
#include "kin2DFrame2.hpp"
#include "lin3DFrame2.hpp"
#include "lin2DTria3.hpp"
#include "lin2DTria6.hpp"
#include "lin2DQuad4.hpp"
#include "lin2DQuad8.hpp"
#include "PML2DQuad4.hpp"
#include "kin2DQuad4.hpp"
#include "PML2DQuad8.hpp"
#include "lin3DShell4.hpp"
#include "lin3DTetra4.hpp"
#include "lin3DTetra10.hpp"
#include "lin3DHexa8.hpp"
#include "kin3DHexa8.hpp"
#include "PML3DHexa8.hpp"
#include "lin3DHexa20.hpp"
#include "EQlin2DQuad4.hpp"
#include "TIEQlin2DQuad4.hpp"
#include "UnxBoucWen2DLink.hpp"
#include "UnxBoucWen3DLink.hpp"
#include "HDRBYamamoto2DLink.hpp"
#include "HDRBYamamoto3DLink.hpp"
#include "null2DFrame2.hpp"
#include "null3DFrame2.hpp"
#include "StaticAnalysis.hpp"
#include "DynamicAnalysis.hpp"
#include "Linear.hpp"
#include "NewtonRaphson.hpp"
#include "QuasiStatic.hpp"
#include "NewmarkBeta.hpp"
#include "CompositeBathe.hpp"
#include "CentralDifference.hpp"
#include "ExtendedNewmarkBeta.hpp"
#include "EigenSolver.hpp"
#include "MumpsSolver.hpp"
#include "PetscSolver.hpp"
#include "RSJparser.hpp"
#include "Definitions.hpp"
#include "Profiler.hpp"

Go to the source code of this file.

Functions

template<typename T >
void sortVector (std::vector< T > &v)
 Sorts a vector of tag number form smaller to larger. More...
 
template<typename T >
std::vector< T > setOperation (std::vector< T > &v1, std::vector< T > &v2, std::string op)
 Performs union, difference or intersection operation between two vectors. More...
 
template<typename T >
std::vector< T > GetIDsFromJSON (RSJresource &jsonFile, std::string Name)
 Query the JSON file and obtains the Identifier list. More...
 
template<typename T >
std::vector< T > GetIDsFromMESH (std::shared_ptr< Mesh > &mesh, std::string Name)
 Query the MESH object and obtains the Identifier list. More...
 
template<typename T >
std::map< std::string, std::vector< T > > Entities2Update (std::shared_ptr< Mesh > &mesh, RSJresource &jsonFile, std::string Name)
 The Entities indexes to be updated. More...
 
std::string GetPartitionName (std::string theFile, int k, bool cond)
 Sets the partition subdomain tag number. More...
 
std::string GetSpacedName (std::string theFile, std::string toReplace)
 Fix blank spaces provided by user in path (if any). More...
 
void UpdateNodes (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Node Entities in Mesh Object. More...
 
void UpdateMasses (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Masses in Mesh Object. More...
 
void UpdateConstraints (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Constraint Entities in Mesh Object. More...
 
void UpdateSupportMotion (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Support Motions in Mesh Object. More...
 
void UpdateMaterials (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Material Entities in Mesh Object. More...
 
void UpdateSections (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Section Entities in Mesh Object. More...
 
void UpdateElements (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Element Entities in Mesh Object. More...
 
void UpdateDampings (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Damping Entities in Mesh Object. More...
 
void UpdateLoads (std::shared_ptr< Mesh > &theMesh, RSJresource &jsonFile)
 Updates the Loads Entities in Mesh Object. More...
 
bool UpdateAnalysis (std::shared_ptr< Mesh > &theMesh, std::unique_ptr< Analysis > &theAnalysis, std::vector< std::shared_ptr< Recorder > > &Recorders, std::map< unsigned int, std::shared_ptr< LoadCombo > > &LoadCombos, std::string InputFile)
 Creates a new Analysis object from the json file. More...
 
void UpdateRecorders (std::vector< std::shared_ptr< Recorder > > &Recorders, std::string InputFile)
 Updates the Recorder Entities required for the Analysis. More...
 
void UpdateCombinations (std::map< unsigned int, std::shared_ptr< LoadCombo > > &LoadCombos, std::string InputFile)
 Updates the Combination Entities required for the Analysis. More...
 
bool UpdateMesh (std::shared_ptr< Mesh > &theMesh, std::string InputFile)
 Populate the Mesh object with the json provided entities. More...
 
void RunDriverFile ()
 Runs the User's JSON Input file. More...
 

Detailed Description

This file contains the "parsing" functions to create, modify and analyze a finite element model provided in JSON format.

Author
Danilo S. Kusanovic (dkusa.nosp@m.nov@.nosp@m.calte.nosp@m.ch.e.nosp@m.du)
Date
June 18, 2021
Version
1.0
See also
main.cpp

Function Documentation

◆ Entities2Update()

template<typename T >
std::map<std::string, std::vector<T> > Entities2Update ( std::shared_ptr< Mesh > &  mesh,
RSJresource jsonFile,
std::string  Name 
)

The Entities indexes to be updated.

Parameters
meshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.
Namename of the entity to be readden from json file.
Returns
A map with the added ("add"), deleted ("del") or modified ("mod") entities with respect to previous mesh.

◆ GetIDsFromJSON()

template<typename T >
std::vector<T> GetIDsFromJSON ( RSJresource jsonFile,
std::string  Name 
)

Query the JSON file and obtains the Identifier list.

Parameters
jsonFilejson file where mesh entities will be readden.
Namename of the entity to be readden from json file.
Returns
A vector with the identifiers in the json file.

◆ GetIDsFromMESH()

template<typename T >
std::vector<T> GetIDsFromMESH ( std::shared_ptr< Mesh > &  mesh,
std::string  Name 
)

Query the MESH object and obtains the Identifier list.

Parameters
meshPointer to the Mesh container.
Namename of the entity to be readden from json file.
Returns
A vector with the identifiers in Mesh.

◆ GetPartitionName()

std::string GetPartitionName ( std::string  theFile,
int  k,
bool  cond 
)

Sets the partition subdomain tag number.

Parameters
theFilefile that contains a character to be replaced.
kthe number to be replaced with.
condcondition to return full path of the file or just the file name.
Returns
the modified string where the preplacement is performed.

◆ GetSpacedName()

std::string GetSpacedName ( std::string  theFile,
std::string  toReplace 
)

Fix blank spaces provided by user in path (if any).

Parameters
theFilefile that contains a character to be replaced.
toReplacethe character to be replaced with.
Returns
the modified string where the preplacement is performed.

◆ RunDriverFile()

void RunDriverFile ( )

Runs the User's JSON Input file.

◆ setOperation()

template<typename T >
std::vector<T> setOperation ( std::vector< T > &  v1,
std::vector< T > &  v2,
std::string  op 
)

Performs union, difference or intersection operation between two vectors.

Parameters
v1vector with the identifiers in json file
v1vector with the identifiers in Mesh object
opoperation to be performed between these two sets
Returns
A vector with the Difference, Intersection, or Union of the two sets.

◆ sortVector()

template<typename T >
void sortVector ( std::vector< T > &  v)

Sorts a vector of tag number form smaller to larger.

Parameters
vvector with the data to be sorted

◆ UpdateAnalysis()

bool UpdateAnalysis ( std::shared_ptr< Mesh > &  theMesh,
std::unique_ptr< Analysis > &  theAnalysis,
std::vector< std::shared_ptr< Recorder > > &  Recorders,
std::map< unsigned int, std::shared_ptr< LoadCombo > > &  LoadCombos,
std::string  InputFile 
)

Creates a new Analysis object from the json file.

Parameters
theAnalysisPointer to the analysis to be created from json file.
RecordersPointer to the recorder vector to be parsed.
LoadCombosPointer to the load combination to be parsed.
InputFilejson file where mesh entities will be readden.

◆ UpdateCombinations()

void UpdateCombinations ( std::map< unsigned int, std::shared_ptr< LoadCombo > > &  LoadCombos,
std::string  InputFile 
)

Updates the Combination Entities required for the Analysis.

Parameters
LoadCombosPointer to the load combination to be parsed.
InputFilejson file where mesh entities will be readden.

◆ UpdateConstraints()

void UpdateConstraints ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Constraint Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateDampings()

void UpdateDampings ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Damping Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateElements()

void UpdateElements ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Element Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateLoads()

void UpdateLoads ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Loads Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateMasses()

void UpdateMasses ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Masses in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateMaterials()

void UpdateMaterials ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Material Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateMesh()

bool UpdateMesh ( std::shared_ptr< Mesh > &  theMesh,
std::string  InputFile 
)

Populate the Mesh object with the json provided entities.

Parameters
theMeshPointer to the Mesh container.
InputFilejson file where mesh entities will be readden.
Returns
whether the mesh update was successful or not.

◆ UpdateNodes()

void UpdateNodes ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Node Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateRecorders()

void UpdateRecorders ( std::vector< std::shared_ptr< Recorder > > &  Recorders,
std::string  InputFile 
)

Updates the Recorder Entities required for the Analysis.

Parameters
RecordersPointer to the recorder vector to be parsed.
InputFilejson file where mesh entities will be readden.

◆ UpdateSections()

void UpdateSections ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Section Entities in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.

◆ UpdateSupportMotion()

void UpdateSupportMotion ( std::shared_ptr< Mesh > &  theMesh,
RSJresource jsonFile 
)

Updates the Support Motions in Mesh Object.

Parameters
theMeshPointer to the Mesh container.
jsonFilejson file where mesh entities will be readden.