Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef ALBANY_STATEINFOSTRUCT
00008 #define ALBANY_STATEINFOSTRUCT
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <string>
00021 #include <vector>
00022 #include "Shards_CellTopologyData.h"
00023 #include "Shards_Array.hpp"
00024 #include "Intrepid_Polylib.hpp"
00025
00026 #include "Adapt_NodalDataBlock.hpp"
00027
00029
00030
00031 namespace Albany {
00032
00033 typedef shards::Array<double, shards::NaturalOrder> MDArray;
00034 typedef std::map< std::string, MDArray > StateArray;
00035 typedef std::vector<StateArray> StateArrayVec;
00036
00037 struct StateArrays {
00038 StateArrayVec elemStateArrays;
00039 StateArrayVec nodeStateArrays;
00040 };
00041
00042 struct MeshSpecsStruct {
00043 MeshSpecsStruct(const CellTopologyData& ctd_, int numDim_,
00044 int cubatureDegree_, std::vector<std::string> nsNames_,
00045 std::vector<std::string> ssNames_,
00046 int worsetSize_, const std::string ebName_,
00047 const std::map<std::string, int>& ebNameToIndex_, bool interleavedOrdering_,
00048 const Intrepid::EIntrepidPLPoly cubatureRule_ = Intrepid::PL_GAUSS)
00049 : ctd(ctd_), numDim(numDim_), cubatureDegree(cubatureDegree_),
00050 nsNames(nsNames_), ssNames(ssNames_), worksetSize(worsetSize_),
00051 ebName(ebName_), ebNameToIndex(ebNameToIndex_),
00052 interleavedOrdering(interleavedOrdering_),
00053 cubatureRule(cubatureRule_) {}
00054 CellTopologyData ctd;
00055 int numDim;
00056 int cubatureDegree;
00057 std::vector<std::string> nsNames;
00058 std::vector<std::string> ssNames;
00059 int worksetSize;
00060 const std::string ebName;
00061 const std::map<std::string, int>& ebNameToIndex;
00062 bool interleavedOrdering;
00063 const Intrepid::EIntrepidPLPoly cubatureRule;
00064 };
00065
00067
00068
00069 struct StateStruct {
00070
00071 enum MeshFieldEntity {WorksetValue, NodalData, ElemNode, QuadPoint};
00072 typedef std::vector<int> FieldDims;
00073
00074 StateStruct (const std::string& name_, MeshFieldEntity ent):
00075 name(name_), responseIDtoRequire(""), output(true),
00076 restartDataAvailable(false), saveOldState(false), pParentStateStruct(NULL), entity(ent)
00077 {};
00078
00079 StateStruct (const std::string& name_, MeshFieldEntity ent, const FieldDims& dims, const std::string& type):
00080 name(name_), responseIDtoRequire(""), output(true), dim(dims), initType(type),
00081 restartDataAvailable(false), saveOldState(false), pParentStateStruct(NULL), entity(ent)
00082 {};
00083
00084 void setInitType(const std::string& type) { initType = type; }
00085 void setInitValue(const double val) { initValue = val; }
00086 void setFieldDims(const FieldDims& dims) { dim = dims; }
00087
00088 void print(){
00089
00090 std::cout << "StateInfoStruct diagnostics for : " << name << std::endl;
00091 std::cout << "Dimensions : " << std::endl;
00092 for(unsigned int i = 0; i < dim.size(); i++)
00093 std::cout << " " << i << " " << dim[i] << std::endl;
00094 std::cout << "Entity : " << entity << std::endl;
00095 }
00096
00097 const std::string name;
00098 FieldDims dim;
00099 MeshFieldEntity entity;
00100 std::string initType;
00101 double initValue;
00102 std::map<std::string, std::string> nameMap;
00103
00104
00105 std::string responseIDtoRequire;
00106
00107 bool output;
00108 bool restartDataAvailable;
00109 bool saveOldState;
00110 StateStruct *pParentStateStruct;
00111
00112 StateStruct ();
00113
00114 };
00115
00116
00117
00118 class StateInfoStruct {
00119 public:
00120
00121 typedef std::vector<Teuchos::RCP<StateStruct> >::const_iterator const_iterator;
00122
00123 Teuchos::RCP<StateStruct>& operator[](int index){ return sis[index]; }
00124 const Teuchos::RCP<StateStruct> operator[](int index) const { return sis[index]; }
00125 void push_back(const Teuchos::RCP<StateStruct>& ss){ sis.push_back(ss); }
00126 std::size_t size() const { return sis.size(); }
00127 Teuchos::RCP<StateStruct>& back(){ return sis.back(); }
00128 const_iterator begin() const { return sis.begin(); }
00129 const_iterator end() const { return sis.end(); }
00130
00131
00132 Teuchos::RCP<Adapt::NodalDataBlock> getNodalDataBlock(){ return nodal_data_block; }
00133
00134 Teuchos::RCP<Adapt::NodalDataBlock> createNodalDataBlock(){
00135 if(Teuchos::is_null(nodal_data_block))
00136 nodal_data_block = Teuchos::rcp(new Adapt::NodalDataBlock);
00137 return nodal_data_block;
00138 }
00139
00140 private:
00141
00142 std::vector<Teuchos::RCP<StateStruct> > sis;
00143 Teuchos::RCP<Adapt::NodalDataBlock> nodal_data_block;
00144
00145 };
00146
00147 }
00148 #endif