IFEM  90A354
SIMdependency.h
Go to the documentation of this file.
1 // $Id$
2 //==============================================================================
12 //==============================================================================
13 
14 #ifndef _SIM_DEPENDENCY_H
15 #define _SIM_DEPENDENCY_H
16 
17 #include <string>
18 #include <vector>
19 #include <map>
20 
21 class ASMbase;
22 class IntegrandBase;
23 
24 
30 {
31 public:
33  typedef std::vector<ASMbase*> PatchVec;
34 
35 private:
37  struct Dependency
38  {
41  std::string name;
42  short int components;
43  short int comp_use;
45  const int* MADOF;
46 
48  Dependency(SIMdependency* s = nullptr, const std::string& f = "",
49  short int n = 1) : sim(s), name(f), components(n), comp_use(1),
50  differentBasis(0), MADOF(nullptr) {}
51  };
52 
54  typedef std::vector<Dependency> DepVector;
56  typedef std::map<std::string,const std::vector<double>*> FieldMap;
57 
58 protected:
61 
62 public:
64  virtual ~SIMdependency() {}
65 
67  virtual size_t getNoSpaceDim() const = 0;
69  virtual std::string getName() const = 0;
70 
78  virtual void registerDependency(SIMdependency* sim, const std::string& name,
79  short int nvc, const PatchVec& patches,
80  char diffBasis = 0, int component = 1);
87  virtual void registerDependency(SIMdependency* sim, const std::string& name,
88  short int nvc, const PatchVec& patches,
89  const int* MADOF);
94  virtual void registerDependency(SIMdependency* sim, const std::string& name,
95  short int nvc = 1);
96 
98  bool fillField(const std::string& name, const std::vector<double>& values);
100  virtual std::vector<double>* getField(const std::string& name);
102  virtual const std::vector<double>* getField(const std::string& name) const;
104  const std::vector<double>* getDependentField(const std::string& name) const;
106  ASMbase* getDependentPatch(const std::string& name, int pindx) const;
108  void registerField(const std::string& name, const std::vector<double>& vec);
110  virtual bool hasIC(const std::string&) const { return false; }
111 
112 private:
114  DepVector::const_iterator getDependency(const std::string& name) const;
115 
116 protected:
122  const PatchVec& model, size_t pindx) const;
123 
124 private:
127 };
128 
129 #endif
Base class for spline-based finite element (FE) assembly drivers.
Definition: ASMbase.h:70
Base class representing a system level integrated quantity.
Definition: IntegrandBase.h:42
Class administering inter-SIM field dependencies.
Definition: SIMdependency.h:30
bool fillField(const std::string &name, const std::vector< double > &values)
Initializes the nodal vector of named field in this SIM.
Definition: SIMdependency.C:56
void registerField(const std::string &name, const std::vector< double > &vec)
Registers a named field with associated nodal vector in this SIM.
Definition: SIMdependency.C:121
ASMbase * getDependentPatch(const std::string &name, int pindx) const
Returns a spline patch associated with a dependent field.
Definition: SIMdependency.C:107
const std::vector< double > * getDependentField(const std::string &name) const
Returns the nodal vector of named field in a dependent SIM.
Definition: SIMdependency.C:97
std::map< std::string, const std::vector< double > * > FieldMap
Field name to nodal values map.
Definition: SIMdependency.h:56
SIMdependency()
The constructor is protected to allow sub-class instances only.
Definition: SIMdependency.h:60
virtual ~SIMdependency()
Empty destructor.
Definition: SIMdependency.h:64
std::vector< Dependency > DepVector
SIM dependency container.
Definition: SIMdependency.h:54
virtual std::string getName() const =0
Returns the given name of this simulator.
virtual std::vector< double > * getField(const std::string &name)
Returns the nodal vector of named field in this SIM.
Definition: SIMdependency.C:68
FieldMap myFields
The named fields of this SIM object.
Definition: SIMdependency.h:125
bool extractPatchDependencies(IntegrandBase *problem, const PatchVec &model, size_t pindx) const
Extracts local solution vector(s) for all dependent fields.
Definition: SIMdependency.C:128
std::vector< ASMbase * > PatchVec
Spline patch container.
Definition: SIMdependency.h:33
DepVector depFields
Other fields this SIM objecy depends on.
Definition: SIMdependency.h:126
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.
Definition: SIMdependency.C:21
DepVector::const_iterator getDependency(const std::string &name) const
Returns an iterator pointing to a named dependency.
Definition: SIMdependency.C:86
virtual size_t getNoSpaceDim() const =0
Returns the number of spatial dimensions in the model.
virtual bool hasIC(const std::string &) const
Checks whether a named initial condition is present.
Definition: SIMdependency.h:110
Struct holding information about an inter-SIM dependency.
Definition: SIMdependency.h:38
short int comp_use
Component to use from field.
Definition: SIMdependency.h:43
PatchVec patches
Patch geometry the field is defined over.
Definition: SIMdependency.h:40
short int components
Number of field components per node.
Definition: SIMdependency.h:42
Dependency(SIMdependency *s=nullptr, const std::string &f="", short int n=1)
Default constructor.
Definition: SIMdependency.h:48
SIMdependency * sim
SIM object holding the dependent field.
Definition: SIMdependency.h:39
char differentBasis
Toggle usage of an independent basis.
Definition: SIMdependency.h:44
const int * MADOF
The MADOF array to associate with field.
Definition: SIMdependency.h:45
std::string name
Field name.
Definition: SIMdependency.h:41