IFEM  90A354
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
SIMinput Class Referenceabstract

Sub-class with functionality for model input and setup. More...

#include <SIMinput.h>

Inheritance diagram for SIMinput:
Inheritance graph
[legend]
Collaboration diagram for SIMinput:
Collaboration graph
[legend]

Classes

struct  ICInfo
 Struct holding information about an initial condition. More...
 

Public Types

typedef std::vector< ICInfoInitialCondVec
 Convenience declaration.
 
typedef std::vector< unsigned char > CharVec
 Convenience declaration.
 
typedef std::pair< int, Vec3IdxVec3
 Convenience declaration.
 
- Public Types inherited from SIMdependency
typedef std::vector< ASMbase * > PatchVec
 Spline patch container.
 

Public Member Functions

virtual ~SIMinput ()
 Empty destructor.
 
virtual const char ** getPrioritizedTags () const
 Returns a list of prioritized XML-tags.
 
bool readTopologyOnly (const std::string &fileName)
 Reads patch topology from the specified input file. More...
 
int getUniquePropertyCode (const std::string &setName, int comp=0)
 Returns a unique integer code for a Property set. More...
 
size_t setVecProperty (int code, Property::Type ptype, VecFunc *field=nullptr, int pflag=-1)
 Defines a vector field property. More...
 
bool setTracProperty (int code, Property::Type ptype, TractionFunc *field=nullptr)
 Defines a traction field property. More...
 
size_t setPropertyType (int code, Property::Type ptype, int pindex=-1, char basis=1)
 Defines the type of a property set. More...
 
bool setNeumann (const std::string &prop, const std::string &type, int ndir, int code)
 Defines a Neumann boundary condition property by parsing a string. More...
 
std::vector< int > getFunctionsForElements (const std::vector< int > &elements)
 Finds the set of basis functions with support on a set of elements. More...
 
bool refine (const LR::RefineData &prm)
 Refines the mesh adaptively. More...
 
bool refine (const LR::RefineData &prm, Vector &sol)
 Refines the mesh adaptively. More...
 
bool refine (const LR::RefineData &prm, Vectors &sol)
 Refines the mesh adaptively. More...
 
int refine (const RealFunc &refC, double refTol)
 Refines the mesh based on a mesh density function. More...
 
bool readPatches (std::istream &isp, const char *whiteSpace="")
 Reads patches from given input stream. More...
 
bool addConnection (int mst, int slv, int mIdx, int sIdx, bool coordCheck=false, int dim=1, int thick=1)
 Connects two patches. More...
 
const std::vector< ASM::Interface > & getInterfaces () const
 Obtain a const reference to model topology.
 
int restartBasis (const std::string &restartFile, int restartStep)
 Handles application restarts by reading a serialized basis. More...
 
virtual bool createFEMmodel (char resetNumb='y')
 Creates the computational FEM model from the spline patches. More...
 
virtual void clonePatches (const PatchVec &, const std::map< int, int > &)
 Creates the computational FEM model by copying the given patches.
 
virtual bool hasIC (const std::string &name) const
 Checks whether a named initial condition is present.
 
bool setInitialConditions (SIMdependency *fieldHolder=nullptr)
 Sets the initial conditions. More...
 
virtual bool deSerialize (const SerializeMap &)
 Deserialization support (for simulation restart).
 
const TopEntitygetEntity (const std::string &name) const
 Returns reference to a named topology entity.
 
TopEntitytopology (const std::string &name)
 Returns access to a named topology entity (for model generators).
 
const TopologySetgetTopology () const
 Returns the whole topology set container (for testing only).
 
bool getTopItemNodes (const TopItem &titem, std::vector< int > &glbNodes) const
 Returns the node numbers associated with a topological item.
 
IdxVec3getDiscretePoint (int idx)
 Returns pointer to an indexed discrete point.
 
virtual std::vector< std::vector< int > > getElmConnectivities () const
 Returns the element-to-element connectivities.
 
- Public Member Functions inherited from SIMbase
virtual ~SIMbase ()
 The destructor frees the dynamically allocated objects.
 
bool readModel (const char *fileName)
 Reads model data from the specified input file *fileName. More...
 
virtual void clearProperties ()
 Initializes the property containers of the model. More...
 
virtual void initForSingleStep ()
 Interface for app-specific single-step simulation initialisation.
 
virtual void initForMultiStep ()
 Interface for app-specific multi-step simulation initialisation.
 
virtual bool preprocessC (const IntVec &ignored, bool fixDup, double time0)
 Performs some pre-processing tasks on the FE model. More...
 
virtual bool merge (SIMbase *that, const std::map< int, int > *old2new=nullptr, int poff=0)
 Merges the global equation system of that simulator with this. More...
 
bool initSystem (LinAlg::MatrixType mType, size_t nMats=1, size_t nVec=1, size_t nScl=0, bool withRF=false)
 Allocates the system matrices of the FE problem to be solved. More...
 
bool initSystem (const SIMbase *that)
 Lets this simulator share equation system with that simulator.
 
void initLHSbuffers ()
 Initializes left-hand-side element matrix buffers for integrand.
 
bool setAssociatedRHS (size_t iMat, size_t iVec)
 Associates a system vector to a system matrix. More...
 
bool setMode (int mode, bool needIntegr=true, bool resetSol=false)
 Defines the solution mode before the element assembly is started. More...
 
void setIntegrationPrm (unsigned short int i, double prm)
 Initializes an integration parameter for the integrand. More...
 
void setQuadratureRule (size_t ng, bool redimBuffers=false, bool printQP=false)
 Defines the spatial numerical integration scheme to use. More...
 
virtual bool printProblem () const
 Prints out problem-specific data to the log stream.
 
const IntegrandBasegetProblem () const
 Returns a pointer to the problem-specific data object.
 
virtual ASM::InterfaceCheckergetInterfaceChecker (size_t) const
 Returns interface checker type for model.
 
void clearProblem ()
 Clears the reference to the problem-specific data object. More...
 
virtual std::string getName () const
 Returns the name of this simulator. More...
 
virtual bool mixedProblem () const
 Returns whether a mixed formulation is used (used by HDF5 output).
 
const LinSolParamsgetSolParams () const
 Returns the linear equation solver parameters (for PETSc).
 
virtual unsigned short int getNoParamDim () const =0
 Returns the number of parameter dimensions in the model.
 
virtual size_t getNoSpaceDim () const
 Returns the number of spatial dimensions in the model.
 
size_t getNoFields (int basis=0) const
 Returns the number of primary solution fields. More...
 
size_t getNoDOFs (bool subSim=false) const
 Returns the model size in terms of number of DOFs.
 
size_t getNoNodes (int basis=0) const
 Returns the model size in terms of number of unique nodes. More...
 
size_t getNoElms (bool includeXelms=false, bool includeZelms=false) const
 Returns the model size in terms of number of elements. More...
 
size_t getNoSolutions (bool allocated=false) const
 Returns the number of solution vectors.
 
int getNoPatches () const
 Returns the total number of patches in the model.
 
size_t getNoEquations () const
 Returns the number of unknowns in the linear equation system.
 
size_t getNoConstraints () const
 Returns the number of constraint equations in the model.
 
virtual size_t getNoRHS () const
 Returns the number of right-hand-side vectors.
 
unsigned char getNoBasis () const
 Returns the number of bases in the model.
 
char getNodeType (int inod) const
 Returns the type (DOF classification) of the specified global node.
 
Vec4 getNodeCoord (int inod) const
 Returns the spatial coordinates of the specified global node.
 
bool isFixed (int inod, int dof=123) const
 Returns true if all DOFs in the specified global node are fixed.
 
int getGlobalNode (int node) const
 Returns the global node number from a process-local node number.
 
int getLocalNode (int node) const
 Returns the process-local node number from a global node number.
 
bool getElmNodes (IntVec &mnpc, int iel) const
 Finds the Matrix of Nodal Point Correspondance for element iel.
 
void getBoundaryNodes (int pcode, IntVec &glbNodes, std::vector< Vec3 > *XYZ=nullptr) const
 Finds the list of global nodes associated with a boundary. More...
 
int findClosestNode (const Vec3 &) const
 Finds the node that is closest to the given point X.
 
IntVec getNodeSet (const std::string &setName) const
 Returns a predefined node set. More...
 
bool initDirichlet (double time=0.0)
 Initializes time-dependent in-homogeneous Dirichlet coefficients. More...
 
bool hasTimeDependentDirichlet () const
 Checks for time-dependent in-homogeneous Dirichlet conditions.
 
virtual bool updateDirichlet (double time=0.0, const Vector *prevSol=nullptr)
 Updates the time-dependent in-homogeneous Dirichlet coefficients. More...
 
virtual bool updateConfiguration (const Vector &)
 Updates problem-dependent state based on the current solution.
 
virtual bool updateRotations (const RealArray &, double=0.0)
 Updates the nodal rotations for problems with rotational DOFs.
 
bool updateGrid (const RealArray &displ)
 Updates the grid coordinates. More...
 
bool updateGrid (const std::string &field)
 Updates the grid coordinates. More...
 
void setRefined (int nref)
 Sets the refinement status (for restart of adaptive simulations). More...
 
int getRefined () const
 Returns current refinement status.
 
bool hasElementActivator () const
 Returns true if an element activation function is specified.
 
void updateForNewElements (Vector &solution, const TimeDomain &time) const
 Modifies the current solution vector when activating elements. More...
 
virtual bool assembleSystem (const TimeDomain &time, const Vectors &prevSol, bool newLHSmatrix=true, bool poorConvg=false)
 Administers assembly of the linear equation system. More...
 
bool assembleSystem (double t0=0.0, const Vectors &pSol=Vectors())
 Administers assembly of the linear equation system. More...
 
bool extractLoadVec (Vector &loadVec, size_t idx=0, const char *hd=nullptr) const
 Extracts the assembled load vector for inspection/visualization. More...
 
bool extractScalars (RealArray &values) const
 Extracts the assembled global scalar quantities.
 
double extractScalar (size_t idx=0) const
 Extracts an assembled global scalar quantity.
 
bool applyDirichlet (Vector &glbVec) const
 Applies the Dirichlet conditions to given vector. More...
 
bool solveEqSystem (Vector &solution, size_t idxRHS, double *rCond, int printSol=0, bool dumpEqSys=false, const char *compName="displacement")
 Solves the assembled linear system of equations for a given load. More...
 
virtual bool solveSystem (Vector &solution, int printSol, double *rCond, const char *compName="displacement", size_t idxRHS=0)
 Solves the assembled linear system of equations for a given load. More...
 
bool solveSystem (Vector &solution, int printSol=0, const char *compName="displacement")
 Solves the assembled linear system of equations for a given load. More...
 
bool solveSystem (Vectors &solution, int printSol=0, const char *cmpName="displacement")
 Solves a linear system of equations with multiple right-hand-sides. More...
 
void getWorstDofs (const Vector &x, const Vector &r, size_t nWorst, double eps, int iteNorm, std::map< std::pair< int, int >, RealArray > &worst) const
 Finds the DOFs showing the worst convergence behavior. More...
 
virtual void iterationNorms (const Vector &x, const Vector &r, double &eNorm, double &rNorm, double &dNorm) const
 Evaluates some iteration norms for convergence assessment. More...
 
double solutionNorms (const Vector &x, double *inf=nullptr, size_t *ind=nullptr, size_t nf=0, char type='D') const
 Evaluates some norms of the primary solution vector. More...
 
bool solutionNorms (const TimeDomain &time, const Vectors &psol, const Vectors &ssol, Vectors &gNorm, Matrix *eNorm=nullptr, const char *name=nullptr)
 Integrates some solution norm quantities. More...
 
bool solutionNorms (const TimeDomain &time, const Vectors &psol, Vectors &gNorm, Matrix *eNorm=nullptr)
 Integrates some solution norm quantities. More...
 
bool solutionNorms (const Vector &psol, const Vectors &ssol, Matrix &eNorm, Vectors &gNorm, const char *name=nullptr)
 Integrates some solution norm quantities. More...
 
bool solutionNorms (const Vector &psol, Matrix &eNorm, Vectors &gNorm)
 Integrates some solution norm quantities. More...
 
bool solutionNorms (const Vector &psol, const Vectors &ssol, Vectors &gNorm, const char *name=nullptr)
 Integrates some solution norm quantities. More...
 
virtual void printStep (int istep, const TimeDomain &time) const
 Prints out load/time step identification. More...
 
virtual void printSolutionSummary (const Vector &solution, int printSol=0, const char *compName=nullptr, std::streamsize outPrec=0)
 Prints a summary of the calculated solution to std::cout. More...
 
bool getCurrentReactions (RealArray &RF, const Vector &psol, int pcode=0) const
 Computes the total reaction forces in the model. More...
 
bool haveReactions (int pcode=0) const
 Checks for total reaction forces associated with a boundary. More...
 
virtual const RealArraygetReactionForces () const
 Returns current reaction force container.
 
bool systemModes (std::vector< Mode > &solution, int nev, int ncv, int iop, double shift, size_t iA=0, size_t iB=1)
 Performs a generalized eigenvalue analysis of the assembled system. More...
 
bool systemModes (std::vector< Mode > &solution, size_t iA=0, size_t iB=1)
 Performs a generalized eigenvalue analysis of the assembled system. More...
 
virtual bool haveBoundaryReactions (bool=false) const
 Returns whether reaction forces are to be computed or not.
 
bool assembleForces (const Vector &solution, double t0, RealArray *R, Vector *S=nullptr)
 Assembles reaction and interface forces for specified boundaries. More...
 
virtual bool project (Matrix &ssol, const Vector &psol, SIMoptions::ProjectionMethod method=SIMoptions::GLOBAL, const TimeDomain &time=TimeDomain()) const
 Projects the secondary solution associated with a primary solution. More...
 
bool project (Vector &ssol, const Vector &psol, SIMoptions::ProjectionMethod method=SIMoptions::GLOBAL, size_t iComp=0) const
 Projects the secondary solution associated with a primary solution. More...
 
bool projectAnaSol (Vector &ssol, SIMoptions::ProjectionMethod method) const
 Projects the analytical secondary solution, if any. More...
 
bool project (RealArray &values, const FunctionBase *f, int basis=1, int iField=0, int nFields=1, SIMoptions::ProjectionMethod method=SIMoptions::GLOBAL, double time=0.0) const
 Projects a function onto the specified basis. More...
 
bool evalSecondarySolution (Matrix &field, int pindx) const
 Evaluates the secondary solution field for specified patch. More...
 
virtual bool fieldProjections () const
 Returns whether projections must be handled through fields or not.
 
virtual bool haveAnaSol () const
 Returns whether an analytical solution is available or not.
 
virtual bool haveDualSol () const
 Returns whether a dual solution is available or not.
 
NormBasegetNormIntegrand () const
 Returns a pointer to a norm integrand object for this simulator. More...
 
ForceBasegetBoundaryForceIntegrand (const Vec3 *X0=nullptr) const
 Returns a pointer to a force integrand object for this simulator. More...
 
ForceBasegetNodalForceIntegrand () const
 Returns a pointer to a force integrand object for this simulator. More...
 
const SAMgetSAM () const
 Returns a const pointer to the SAM object of this simulator.
 
void registerDependency (const std::string &name, SIMdependency *sim, short int nvc=1, unsigned char basis=1)
 Registers a dependency on a field from another SIM object. More...
 
bool extractPatchSolution (const Vectors &sol, size_t pindx) const
 Extracts all local solution vector(s) for a specified patch. More...
 
size_t extractPatchSolution (const RealArray &sol, RealArray &vec, const ASMbase *pch, unsigned char nndof=0, unsigned char basis=0) const
 Extracts a local solution vector for a specified patch. More...
 
bool injectPatchSolution (RealArray &sol, const RealArray &vec, const ASMbase *pch, unsigned char nndof=0, unsigned char basis=0) const
 Injects a patch-wise solution vector into the global vector. More...
 
bool extractPatchElmRes (const Matrix &glbRes, Matrix &elRes, int pindx) const
 Extracts element results for a specified patch. More...
 
int getLocalPatchIndex (int patchNo) const
 Returns the local patch index for the given global patch number. More...
 
const PatchVecgetFEModel () const
 Returns a const reference to our FEM model.
 
ASMbasegetPatch (int idx, bool glbIndex=false) const
 Returns a pointer to a specified patch of our FEM model. More...
 
bool setPatchMaterial (size_t patch) const
 Initializes material properties for the given patch.
 
const std::map< int, int > & getGlob2LocMap () const
 Returns a const reference to our global-to-local node mapping.
 
PropertyVec::const_iterator begin_prop () const
 Returns the beginning of the property array.
 
PropertyVec::const_iterator end_prop () const
 Returns the end of the property array.
 
SystemMatrixgetRayleighDampingMatrix (size_t iM=1, size_t iK=0) const
 Returns current Rayleigh system damping matrix. More...
 
SystemMatrixgetLHSmatrix (size_t idx=0, bool copy=false) const
 Returns current system left-hand-side matrix.
 
SystemVectorgetRHSvector (size_t idx=0, bool copy=false) const
 Returns current system right-hand-side vector.
 
void addToRHSvector (size_t idx, const SystemVector &vec, double scale=1.0)
 Adds a system vector to the given right-hand-side vector.
 
RealFuncgetSclFunc (int code) const
 Returns a scalar function associated with code.
 
void setMDflag (char flag)
 Sets the multi-dimension simulator sequence flag.
 
bool isFirst () const
 Returns true, if this is the equation system owner.
 
void dumpEqSys (bool initialBlankLine=false)
 Dumps left-hand-side matrix and right-hand-side vector to file.
 
void dumpSolVec (const Vector &x, bool isExpanded=true, bool expOnly=false)
 Dumps a solution vector to file.
 
virtual int printNRforces (const IntVec &={}) const
 Prints out nodal reaction forces to the log stream.
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc, const PatchVec &patches, char diffBasis=0, int component=1)
 Registers a dependency on a field from another SIM object. More...
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc, const PatchVec &patches, const int *MADOF)
 Registers a dependency on a field from another SIM object. More...
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc=1)
 Registers a dependency on a field from another SIM object. More...
 
- Public Member Functions inherited from SIMadmin
virtual ~SIMadmin ()
 Empty destructor.
 
virtual bool read (const char *fileName)
 Reads model data from the specified input file *fileName.
 
virtual bool preprocess (const IntVec &ignored={}, bool fixDup=false)
 Performs some pre-processing tasks on the FE model.
 
const ProcessAdmgetProcessAdm () const
 Returns the parallel process administrator.
 
int getGlobalProcessID () const
 Returns the global process ID. More...
 
const std::string & getHeading () const
 Returns the simulator heading.
 
void setHeading (const std::string &heading)
 Defines the simulator heading.
 
void printHeading (int &supStep) const
 Prints the heading of this simulator, if any, to IFEM::cout.
 
- Public Member Functions inherited from XMLInputBase
bool readXML (const char *fileName, bool verbose=true)
 Reads an XML input file. More...
 
bool loadXML (const char *xml)
 Loads data from an XML-formatted text string. More...
 
- Public Member Functions inherited from SIMdependency
virtual ~SIMdependency ()
 Empty destructor.
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc, const PatchVec &patches, char diffBasis=0, int component=1)
 Registers a dependency on a field from another SIM object. More...
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc, const PatchVec &patches, const int *MADOF)
 Registers a dependency on a field from another SIM object. More...
 
virtual void registerDependency (SIMdependency *sim, const std::string &name, short int nvc=1)
 Registers a dependency on a field from another SIM object. More...
 
bool fillField (const std::string &name, const std::vector< double > &values)
 Initializes the nodal vector of named field in this SIM.
 
virtual std::vector< double > * getField (const std::string &name)
 Returns the nodal vector of named field in this SIM.
 
virtual const std::vector< double > * getField (const std::string &name) const
 Returns the nodal vector of named field in this SIM.
 
const std::vector< double > * getDependentField (const std::string &name) const
 Returns the nodal vector of named field in a dependent SIM.
 
ASMbasegetDependentPatch (const std::string &name, int pindx) const
 Returns a spline patch associated with a dependent field.
 
void registerField (const std::string &name, const std::vector< double > &vec)
 Registers a named field with associated nodal vector in this SIM.
 

Protected Types

typedef std::map< std::string, std::string > SerializeMap
 Convenience type.
 
- Protected Types inherited from SIMbase
typedef std::map< int, RealFunc * > SclFuncMap
 Scalar field container.
 
typedef std::map< int, VecFunc * > VecFuncMap
 Vector field container.
 
typedef std::map< int, TractionFunc * > TracFuncMap
 Traction field container.
 
typedef std::multimap< int, IntegrandBase * > IntegrandMap
 Property code to integrand map.
 
- Protected Types inherited from SIMadmin
using IntVec = std::vector< int >
 Convenience alias.
 

Protected Member Functions

 SIMinput (IntegrandBase *itg)
 The constructor just forwards to the base class constructor.
 
virtual bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream. More...
 
virtual bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document. More...
 
virtual bool parseGeometryDimTag (const tinyxml2::XMLElement *elem)=0
 Parses a dimension-specific subelement of the geometry XML-tag.
 
bool parsePeriodic (const tinyxml2::XMLElement *elem)
 Parses the periodic XML-tag. More...
 
virtual bool parseOutputTag (const tinyxml2::XMLElement *elem)
 Parses a subelement of the resultoutput XML-tag.
 
FunctionBaseparseDualTag (const tinyxml2::XMLElement *elem, int ftype=1)
 Parses the dualfield tag.
 
int parseMaterialSet (const tinyxml2::XMLElement *elem, int mindex)
 Parses the "set" attribute of a material XML-tag. More...
 
bool parseTopologySet (const tinyxml2::XMLElement *elem, std::vector< int > &patches) const
 Parses the "set" attribute of a refine/raiseorder XML-tag. More...
 
bool parsePatchList (const tinyxml2::XMLElement *elem, std::vector< int > &patches) const
 Parses a list of patch indices from an XML-tag. More...
 
bool createPropertySet (const std::string &setName, int pc)
 Creates a set of Property objects. More...
 
virtual ASMbasereadPatch (std::istream &isp, int pchInd, const CharVec &unf=CharVec(), const char *whiteSpace="") const =0
 Reads a patch from given input stream. More...
 
virtual bool readNodes (std::istream &isn, int pchInd, int basis=0, bool oneBased=false)
 Reads global node data for a patch from given input stream. More...
 
virtual void readNodes (std::istream &isn)
 Reads node numbers from given input stream. More...
 
virtual ModelGeneratorgetModelGenerator (const tinyxml2::XMLElement *geo) const =0
 Instantiates a FEM model generator. More...
 
virtual bool connectPatches (const ASM::Interface &ifc, bool coordCheck)=0
 Connects two patches. More...
 
bool saveBasis (SerializeMap &data) const
 Writes current basis to a serialization container. More...
 
bool restoreBasis (const SerializeMap &data)
 Restores the basis from a serialization container. More...
 
- Protected Member Functions inherited from SIMbase
 SIMbase (IntegrandBase *itg)
 The constructor initializes the pointers to dynamic data members.
 
VecFuncgetVecFunc (size_t patch, Property::Type ptype) const
 Returns a vector function associated with given patch and property. More...
 
virtual bool addConstraint (int patch, int lndx, int ldim, int dirs, int code, int &ngnod, char basis=1, bool ovrD=false)
 Preprocesses a user-defined Dirichlet boundary property. More...
 
virtual void preprocessA ()
 Preprocessing performed before the FEM model generation.
 
virtual bool preprocessBeforeAsmInit (int &)
 Specialized preprocessing performed before assembly initialization.
 
virtual bool preprocessB ()
 Preprocessing performed after the system assembly initialization.
 
virtual void preprocessResultPoints ()=0
 Preprocesses the result sampling points.
 
int renumberNodes (bool renumMNPC=false)
 Renumbers the global node numbers after resolving patch topology. More...
 
virtual bool renumberNodes (const std::map< int, int > &)
 Interface for renumbering of app-specific node number tables.
 
virtual bool extractPatchSolution (IntegrandBase *problem, const Vectors &sol, size_t pindx) const
 Extracts all local solution vector(s) for a specified patch. More...
 
char getMDflag () const
 Returns the multi-dimension simulator sequence flag.
 
virtual void shiftGlobalNums (int, int)
 Shifts global node and element numbers by constant offsets.
 
virtual bool initMaterial (size_t)
 Initializes material properties for integration of interior terms.
 
virtual bool initBodyLoad (size_t)
 Initializes the body load properties for current patch.
 
virtual bool initNeumann (size_t)
 Initializes for integration of Neumann terms for a given property.
 
virtual bool assembleDiscreteTerms (const IntegrandBase *, const TimeDomain &)
 Assembles problem-dependent discrete terms, if any.
 
virtual bool assembleDiscreteItems (const IntegrandBase *itg, const TimeDomain &time, const Vectors &)
 Assembles problem-dependent discrete terms, if any. More...
 
virtual double externalEnergy (const Vectors &psol, const TimeDomain &) const
 Computes (possibly problem-dependent) external energy contribution.
 
virtual bool postProcessNorms (Vectors &, Matrix *)
 Applies app-specific post-processing on norms.
 
void generateThreadGroups (const Property &p, bool silence=false)
 Generates element groups for multi-threading of boundary integrals. More...
 
void changeNumThreads ()
 Called if number of threads changes.
 
bool addMADOF (unsigned char basis, unsigned char nndof, bool other=true)
 Adds a MADOF with an extraordinary number of DOFs on a given basis. More...
 
double * theExtEnerg ()
 Returns a pointer to the external energy path integral value.
 
const double * getExtEnerg () const
 Returns a const pointer to the external energy path integral value.
 
- Protected Member Functions inherited from SIMadmin
 SIMadmin (const char *heading=nullptr)
 The default constructor initializes the process administrator.
 
 SIMadmin (SIMadmin &anotherSIM)
 Copy constructor.
 
- Protected Member Functions inherited from XMLInputBase
const tinyxml2::XMLElement * loadFile (tinyxml2::XMLDocument &doc, const char *fileName, bool verbose=false)
 Loads an XML input file into a tinyxml2::XMLDocument object. More...
 
- Protected Member Functions inherited from SIMdependency
 SIMdependency ()
 The constructor is protected to allow sub-class instances only.
 
bool extractPatchDependencies (IntegrandBase *problem, const PatchVec &model, size_t pindx) const
 Extracts local solution vector(s) for all dependent fields. More...
 

Static Protected Member Functions

static std::istream * getPatchStream (const char *tag, const char *patch)
 Helper method returning a stream for patch geometry input. More...
 

Protected Attributes

ModelGeneratormyGen
 Model generator.
 
TopologySet myEntitys
 Set of named topological entities.
 
std::vector< IdxVec3myTopPts
 Discrete points not belonging to any patch.
 
std::vector< ASM::InterfacemyInterfaces
 Topology interface descriptions.
 
std::map< std::string, InitialCondVecmyICs
 Initial condition definitions.
 
- Protected Attributes inherited from SIMbase
unsigned char nsd
 Number of spatial dimensions.
 
PatchVec myModel
 The actual NURBS/spline model.
 
PropertyVec myProps
 Physical property mapping.
 
SclFuncMap myScalars
 Scalar property fields.
 
VecFuncMap myVectors
 Vector property fields.
 
TracFuncMap myTracs
 Traction property fields.
 
IntegrandBasemyProblem
 The main integrand of this simulator.
 
IntegrandMap myInts
 Set of all integrands involved.
 
AnaSolmySol
 Analytical/Exact solution.
 
FunctionBasedualField
 Dual solution field (extraction function)
 
std::vector< FunctionBase * > extrFunc
 Extraction functions for VCP.
 
int nGlbNodes
 Total number of unique nodes in the model. More...
 
int isRefined
 Indicates if the model is adaptively refined.
 
bool lagMTOK
 Indicates if global multipliers is OK with multithreading.
 
bool fixZeros
 If true, constrain zero pivots before solving.
 
std::vector< DumpDatalhsDump
 Coefficient matrix dump specifications.
 
std::vector< DumpDatarhsDump
 Right-hand-side vector dump specifications.
 
std::vector< DumpDatasolDump
 Solution vector dump specifications.
 
int nGlPatches
 Number of global patches.
 
IntVec myPatches
 Global patch numbers for current processor.
 
IntVec myLoc2Glb
 Local-to-global node number mapping.
 
std::map< int, int > myGlb2Loc
 Global-to-local node number mapping.
 
const std::map< int, int > * g2l
 Pointer to global-to-local node mapping.
 
std::map< int, int > myDegenElm
 Degenerated elements mapping.
 
std::set< int > myDupNodes
 Set of duplicated nodes.
 
AlgEqSystemmyEqSys
 The actual linear equation system.
 
SAMmySam
 Auxiliary data for FE assembly management.
 
LinSolParamsmySolParams
 Input parameters for PETSc.
 
LinSolParamsmyGl2Params
 Input parameters for PETSc, for L2 projection.
 
- Protected Attributes inherited from SIMadmin
ProcessAdm adm
 Parallel administrator.
 
int myPid
 Processor ID in parallel simulations.
 
int nProc
 Number of processors in parallel simulations.
 
std::string myHeading
 Heading written before reading the input file.
 

Private Member Functions

bool parseGeometryTag (const tinyxml2::XMLElement *elem)
 Parses a subelement of the geometry XML-tag.
 
bool parseBCTag (const tinyxml2::XMLElement *elem)
 Parses a subelement of the boundaryconditions XML-tag.
 
bool parseICTag (const tinyxml2::XMLElement *elem)
 Parses the initialconditions XML-tag.
 
bool parseLinSolTag (const tinyxml2::XMLElement *elem)
 Parses a subelement of the linearsolver XML-tag.
 
bool setInitialCondition (SIMdependency *fieldHolder, const std::string &fileName, const InitialCondVec &info)
 Sets initial conditions from a file. More...
 

Private Attributes

bool isReading
 If true, we are reading multiple patch tags.
 
bool isSaved
 If true, the basis has been serialized.
 

Additional Inherited Members

- Public Attributes inherited from SIMadmin
SIMoptionsopt
 Simulation control parameters.
 
- Static Public Attributes inherited from SIMbase
static bool ignoreDirichlet = false
 Set to true for free vibration analysis.
 
static bool preserveNOrder = false
 Set to true to preserve node ordering.
 
- Static Public Attributes inherited from SIMadmin
static int msgLevel = 2
 Controls the console output amount during solving.
 

Detailed Description

Sub-class with functionality for model input and setup.

This class extends the SIMbase class with some added functionalities for reading model definitions from input file. This also includes reading initial conditions from HDF5-files and adaptive refinement. These items are put in a separate sub-class to hide them away from the SIMbase class, which contains the actual simulation driver (i.e., the computational methods).

Member Function Documentation

◆ addConnection()

bool SIMinput::addConnection ( int  mst,
int  slv,
int  mIdx,
int  sIdx,
bool  coordCheck = false,
int  dim = 1,
int  thick = 1 
)
inline

Connects two patches.

Parameters
[in]mstMaster patch
[in]slvSlave patch
[in]mIdxBoundary index on master patch
[in]sIdxBoundary index on slave patch
[in]coordCheckIf true, check for matching coordinates
[in]dimDimensionality of connection
[in]thickThickness of connection

References connectPatches().

Referenced by MultiPatchModelGenerator1D::createTopology(), MultiPatchModelGenerator2D::createTopology(), and MultiPatchModelGenerator3D::createTopology().

◆ connectPatches()

virtual bool SIMinput::connectPatches ( const ASM::Interface ifc,
bool  coordCheck 
)
protectedpure virtual

Connects two patches.

Parameters
[in]ifcPatch interface definition
[in]coordCheckIf false, do not check for matching coordinates

Implemented in SIM1D, SIM3D, SIM2D, and SIMdummy< SIMgeneric >.

Referenced by addConnection().

◆ createFEMmodel()

bool SIMinput::createFEMmodel ( char  resetNumb = 'y')
virtual

◆ createPropertySet()

bool SIMinput::createPropertySet ( const std::string &  setName,
int  pc 
)
protected

Creates a set of Property objects.

Parameters
[in]setNameName of the topology set the property is defined on
[in]pcThe property code to be associated with this set

References TopItem::idim, TopItem::item, myEntitys, SIMbase::myProps, and TopItem::patch.

Referenced by getUniquePropertyCode().

◆ getFunctionsForElements()

IntVec SIMinput::getFunctionsForElements ( const std::vector< int > &  elements)

Finds the set of basis functions with support on a set of elements.

Parameters
[in]elements0-based element indices
Returns
0-based node indices with support on the given elements

References ASMLRSpline::getFunctionsForElements(), and SIMbase::myModel.

Referenced by refine().

◆ getModelGenerator()

virtual ModelGenerator* SIMinput::getModelGenerator ( const tinyxml2::XMLElement *  geo) const
protectedpure virtual

Instantiates a FEM model generator.

Parameters
[in]geoXML element containing geometry definition

Implemented in SIM3D, SIM2D, SIM1D, and SIMdummy< SIMgeneric >.

Referenced by SIMgeneric::createDefaultModel(), and parse().

◆ getPatchStream()

std::istream * SIMinput::getPatchStream ( const char *  tag,
const char *  patch 
)
staticprotected

Helper method returning a stream for patch geometry input.

Parameters
[in]tagThe XML-tag containing the patch geometry definition
[in]patchThe value of the tag, either a file name or g2 string

References IFEM::cout.

Referenced by SIM1D::parseGeometryTag(), SIM2D::parseGeometryTag(), SIM3D::parseGeometryTag(), and parseGeometryTag().

◆ getUniquePropertyCode()

int SIMinput::getUniquePropertyCode ( const std::string &  setName,
int  comp = 0 
)

Returns a unique integer code for a Property set.

Parameters
[in]setNameName of the topology set the property is defined on
[in]compThe solution components on which the property is applied

The actual Property objects are also created (one for each entity in the topology set) and their type is set to UNDEFINED. The method setPropertyType must be used to assign the actual Property type.

References createPropertySet(), and SIMbase::myProps.

Referenced by parseBCTag(), and parseMaterialSet().

◆ parse() [1/2]

bool SIMinput::parse ( char *  keyWord,
std::istream &  is 
)
protectedvirtual

◆ parse() [2/2]

bool SIMinput::parse ( const tinyxml2::XMLElement *  elem)
protectedvirtual

◆ parseMaterialSet()

int SIMinput::parseMaterialSet ( const tinyxml2::XMLElement *  elem,
int  mindex 
)
protected

Parses the "set" attribute of a material XML-tag.

Parameters
[in]elemThe XML element extract the set name from
[in]mindexIndex into problem-dependent material property container
Returns
The property code to be associated with the material

References utl::getAttribute(), getUniquePropertyCode(), and setPropertyType().

◆ parsePatchList()

bool SIMinput::parsePatchList ( const tinyxml2::XMLElement *  elem,
std::vector< int > &  patches 
) const
protected

Parses a list of patch indices from an XML-tag.

Parameters
[in]elemThe XML element extract the patch indices from
[in]patchesList of patch indices

References utl::getAttribute(), SIMbase::myModel, and SIMbase::nGlPatches.

Referenced by parseTopologySet().

◆ parsePeriodic()

bool SIMinput::parsePeriodic ( const tinyxml2::XMLElement *  elem)
protected

Parses the periodic XML-tag.

This method can not be part of the SIMinput::parseGeometryTag() method, since the periodicities must be processed after the patches have been order-elevated and/or refined. The method is instead invoked from the dimension-specific sub-classes which handle the refinements.

References ASMbase::closeBoundaries(), IFEM::cout, utl::getAttribute(), SIMbase::getPatch(), and SIMbase::nGlPatches.

Referenced by SIM1D::parseGeometryTag(), SIM2D::parseGeometryTag(), and SIM3D::parseGeometryTag().

◆ parseTopologySet()

bool SIMinput::parseTopologySet ( const tinyxml2::XMLElement *  elem,
std::vector< int > &  patches 
) const
protected

Parses the "set" attribute of a refine/raiseorder XML-tag.

Parameters
[in]elemThe XML element extract the set name from
[in]patchesList of patch indices of the specified set

References utl::getAttribute(), TopItem::idim, myEntitys, parsePatchList(), and TopItem::patch.

Referenced by SIM1D::parseGeometryTag(), SIM2D::parseGeometryTag(), and SIM3D::parseGeometryTag().

◆ readNodes() [1/2]

virtual void SIMinput::readNodes ( std::istream &  isn)
inlineprotectedvirtual

Reads node numbers from given input stream.

Parameters
[in]isnThe input stream to read from

Reimplemented in SIM3D, and SIM2D.

◆ readNodes() [2/2]

virtual bool SIMinput::readNodes ( std::istream &  isn,
int  pchInd,
int  basis = 0,
bool  oneBased = false 
)
inlineprotectedvirtual

Reads global node data for a patch from given input stream.

Parameters
[in]isnThe input stream to read from
[in]pchInd0-based index of the patch to read node data for
[in]basisThe basis to read node data for (when mixed FEM, 0 = all)
[in]oneBasedIf true the read node numbers are assumed one-based. If false they are assumed to be zero-based.

Reimplemented in SIM3D, and SIM2D.

Referenced by parse().

◆ readPatch()

virtual ASMbase* SIMinput::readPatch ( std::istream &  isp,
int  pchInd,
const CharVec unf = CharVec(),
const char *  whiteSpace = "" 
) const
protectedpure virtual

Reads a patch from given input stream.

Parameters
[in]ispThe input stream to read from
[in]pchInd0-based index of the patch to read
[in]unfNumber of unknowns per basis function for each field
[in]whiteSpaceFor message formatting

Implemented in SIM3D, SIM2D, SIM1D, SIMsupel, and SIMdummy< SIMgeneric >.

Referenced by parse(), readPatches(), and setInitialCondition().

◆ readPatches()

bool SIMinput::readPatches ( std::istream &  isp,
const char *  whiteSpace = "" 
)

◆ readTopologyOnly()

bool SIMinput::readTopologyOnly ( const std::string &  fileName)

Reads patch topology from the specified input file.

Parameters
[in]fileNamePath to XML file to read patch topology from

This method is typically invoked by coupled simulators using shared grids. It is then invoked for the simulator that owns the grid to resolve the patch topology, in case the other simulators using the grid invokes SIMbase::preprocess() first.

References XMLInputBase::loadFile(), SIMbase::nGlbNodes, parseGeometryDimTag(), and SIMbase::renumberNodes().

◆ refine() [1/4]

bool SIMinput::refine ( const LR::RefineData prm)

Refines the mesh adaptively.

Parameters
[in]prmInput data used to control the refinement

Referenced by AdaptiveSIM::adaptMesh(), SIM1D::parse(), and refine().

◆ refine() [2/4]

bool SIMinput::refine ( const LR::RefineData prm,
Vector sol 
)

Refines the mesh adaptively.

Parameters
[in]prmInput data used to control the refinement
[in]solVector to interpolate onto refined mesh

References utl::vector< T >::empty(), refine(), and utl::vector< T >::swap().

◆ refine() [3/4]

bool SIMinput::refine ( const LR::RefineData prm,
Vectors sol 
)

Refines the mesh adaptively.

Parameters
[in]prmInput data used to control the refinement
[in]solVectors to interpolate onto refined mesh

References LR::RefineData::elements, LR::RefineData::errors, SIMbase::extractPatchSolution(), SIMbase::getNoNodes(), SIMbase::getPatch(), SIMbase::isRefined, isSaved, ASMbase::isShared(), LR::RefineData::MLGN, SIMbase::myModel, SIMbase::nGlPatches, and refine().

◆ refine() [4/4]

int SIMinput::refine ( const RealFunc refC,
double  refTol 
)

Refines the mesh based on a mesh density function.

Parameters
[in]refCMesh refinement criteria function
[in]refTolMesh refinement threshold
Returns
Positive value on refinement, negative value on error, zero if no elements are refined

Refines all elements for which refC(X0) < refTol, where X0 is the element center.

References LR::RefineData::elements, ASMbase::generateFEMTopology(), ASMunstruct::getElementCenter(), ASMbase::getElmID(), getFunctionsForElements(), ASMbase::getNoElms(), SIMbase::isRefined, SIMbase::myModel, SIMbase::nGlPatches, LR::RefineData::options, refine(), and ASMbase::resetNumbering().

◆ restartBasis()

int SIMinput::restartBasis ( const std::string &  restartFile,
int  restartStep 
)

Handles application restarts by reading a serialized basis.

Parameters
[in]restartFilePath to file to read restart basis from
[in]restartStepIndex of the time step to read restart basis for
Returns
One-based index of the first time step to solve after restart. If zero, no restart specified. If one, no serialized basis stored. If negative, read failure.

References IFEM::cout, SIMbase::getName(), HDF5Restart::readData(), and restoreBasis().

◆ restoreBasis()

bool SIMinput::restoreBasis ( const SerializeMap data)
protected

Restores the basis from a serialization container.

Parameters
[in]dataContainer for serialized data

References IFEM::cout, SIMbase::getName(), SIMbase::isRefined, SIMbase::myModel, SIMbase::myPatches, and SIMbase::nGlPatches.

Referenced by restartBasis().

◆ saveBasis()

bool SIMinput::saveBasis ( SerializeMap data) const
protected

Writes current basis to a serialization container.

Parameters
dataContainer for serialized data

References IFEM::cout, ASMbase::getMinimumSize(), SIMbase::getName(), SIMbase::isRefined, isSaved, SIMbase::myModel, and ASMbase::write().

◆ setInitialCondition()

bool SIMinput::setInitialCondition ( SIMdependency fieldHolder,
const std::string &  fileName,
const InitialCondVec info 
)
private

Sets initial conditions from a file.

Parameters
fieldHolderThe SIM-object to inject the initial conditions into
[in]fileNamePath to file to read the initial conditions from
[in]infoInitial condition information

References SIMadmin::adm, ProcessAdm::broadcast(), ProcessAdm::dd, ASMbase::evaluate(), SIMdependency::getField(), HDF5Reader::getFieldSize(), SIMbase::getLocalPatchIndex(), SIMbase::getNoFields(), ASMbase::getNoNodes(), ProcessAdm::getProcId(), ASMbase::injectNodeVec(), DomainDecomposition::isPartitioned(), SIMbase::myModel, readPatch(), HDF5Reader::readString(), HDF5Reader::readVector(), and utl::vector< T >::size().

Referenced by setInitialConditions().

◆ setInitialConditions()

bool SIMinput::setInitialConditions ( SIMdependency fieldHolder = nullptr)

Sets the initial conditions.

Parameters
fieldHolderThe SIM-object to inject the initial conditions into, nullptr means this.

References SIMinput::ICInfo::basis, SIMinput::ICInfo::component, IFEM::cout, SIMinput::ICInfo::file_field, SIMinput::ICInfo::function, SIMdependency::getField(), myICs, utl::parseRealFunc(), SIMbase::project(), setInitialCondition(), and SIMinput::ICInfo::sim_field.

◆ setNeumann()

bool SIMinput::setNeumann ( const std::string &  prop,
const std::string &  type,
int  ndir,
int  code 
)

Defines a Neumann boundary condition property by parsing a string.

Parameters
[in]propThe string to parse the property definition from
[in]typeAdditional option defining the type of property definition
[in]ndirDirection of the surface traction on the Neumann boundary
[in]codeThe property code to be associated with this property

References SIMbase::getNoFields(), SIMbase::myScalars, SIMbase::myTracs, SIMbase::myVectors, SIMbase::nsd, utl::parseRealFunc(), utl::parseTracFunc(), utl::parseVecFunc(), and setPropertyType().

Referenced by parseBCTag().

◆ setPropertyType()

size_t SIMinput::setPropertyType ( int  code,
Property::Type  ptype,
int  pindex = -1,
char  basis = 1 
)

Defines the type of a property set.

Parameters
[in]codeThe property code to be associated with the property type
[in]ptypeThe property type to be associated with the given code
[in]pindex0-based index into problem-dependent property container
[in]basis1-based index into basis associated with property

Negative values on pindex are used to flag the use of local axes for Dirichlet boundary conditions as follows: pindex=-2 : Compute local axes directions directly at the Greville points. pindex=-3 : Compute local axes directions by projecting the local tangent direction onto the spline basis, to obtain directions at control points.

References ASMbase::getNoParamDim(), SIMbase::getPatch(), LOCAL_AXES, LOCAL_PROJECTED, SIMbase::myModel, SIMbase::myProps, and SIMbase::preserveNOrder.

Referenced by parse(), parseBCTag(), parseMaterialSet(), setNeumann(), setTracProperty(), and setVecProperty().

◆ setTracProperty()

bool SIMinput::setTracProperty ( int  code,
Property::Type  ptype,
TractionFunc field = nullptr 
)

Defines a traction field property.

Parameters
[in]codeThe property code to be associated with the property
[in]ptypeThe property type to be associated with the given code
[in]fieldThe traction field representing the physical property

References SIMbase::myTracs, and setPropertyType().

◆ setVecProperty()

size_t SIMinput::setVecProperty ( int  code,
Property::Type  ptype,
VecFunc field = nullptr,
int  pflag = -1 
)

Defines a vector field property.

Parameters
[in]codeThe property code to be associated with the property
[in]ptypeThe property type to be associated with the given code
[in]fieldThe vector field representing the physical property
[in]pflagFlag for local axis directions (see setPropertyType)

References SIMbase::myVectors, and setPropertyType().


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