ESYS13
Revision_
|
00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2012 by University of Queensland 00005 * Earth Systems Science Computational Center (ESSCC) 00006 * http://www.uq.edu.au/esscc 00007 * 00008 * Primary Business: Queensland, Australia 00009 * Licensed under the Open Software License version 3.0 00010 * http://www.opensource.org/licenses/osl-3.0.php 00011 * 00012 *******************************************************/ 00013 00014 #ifndef __WEIPA_FINLEYELEMENTS_H__ 00015 #define __WEIPA_FINLEYELEMENTS_H__ 00016 00017 #include <weipa/ElementData.h> 00018 #include <weipa/FinleyNodes.h> 00019 00020 extern "C" { 00021 #include <dudley/ElementType.h> // for Dudley_ElementTypeId 00022 #include <finley/ReferenceElements.h> // for Finley_ElementTypeId 00023 } 00024 00025 class DBfile; 00026 class NcFile; 00027 00028 struct Dudley_ElementFile; 00029 struct Finley_ElementFile; 00030 00031 namespace weipa { 00032 00035 struct FinleyElementInfo 00036 { 00037 ZoneType elementType, reducedElementType; 00038 int elementFactor; 00039 int elementSize, reducedElementSize; 00040 const size_t* multiCellIndices; 00041 bool useQuadNodes; 00042 int quadDim; 00043 }; 00044 00045 class FinleyElements; 00046 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr; 00047 00057 class FinleyElements : public ElementData 00058 { 00059 public: 00060 00062 FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes); 00063 00065 FinleyElements(const FinleyElements& e); 00066 00068 virtual ~FinleyElements() {} 00069 00071 bool initFromDudley(const Dudley_ElementFile* dudleyFile); 00072 00074 bool initFromFinley(const Finley_ElementFile* finleyFile); 00075 00077 bool readFromNc(NcFile* ncfile); 00078 00081 void reorderGhostZones(int ownIndex); 00082 00084 void removeGhostZones(int ownIndex); 00085 00087 virtual void writeConnectivityVTK(std::ostream& os); 00088 00094 bool writeToSilo(DBfile* dbfile, const std::string& siloPath, 00095 const StringVec& labels, const StringVec& units, 00096 bool writeMeshData); 00097 00099 virtual StringVec getMeshNames() const; 00100 00102 virtual StringVec getVarNames() const; 00103 00105 virtual int getNumElements() const { return numElements; } 00106 00108 virtual int getNodesPerElement() const { return nodesPerElement; } 00109 00111 virtual int getGhostCount() const { return numGhostElements; } 00112 00114 virtual ZoneType getType() const { return type; } 00115 00117 Finley_ElementTypeId getFinleyTypeId() const { return finleyTypeId; } 00118 00120 virtual const IntVec& getNodeList() const { return nodes; } 00121 00123 virtual const IntVec& getIDs() const { return ID; } 00124 00128 virtual const IntVec& getVarDataByName(const std::string varName) const; 00129 00131 virtual NodeData_ptr getNodes() const { return nodeMesh; } 00132 00134 virtual ElementData_ptr getReducedElements() const { return reducedElements; } 00135 00137 virtual const QuadMaskInfo& getQuadMask(int functionSpace) const; 00138 00142 virtual int getElementFactor() const { return elementFactor; } 00143 00144 private: 00145 FinleyElements() {} 00146 FinleyElementInfo getDudleyTypeInfo(Dudley_ElementTypeId typeId); 00147 FinleyElementInfo getFinleyTypeInfo(Finley_ElementTypeId typeId); 00148 void buildMeshes(); 00149 void buildReducedElements(const FinleyElementInfo& f); 00150 IntVec prepareGhostIndices(int ownIndex); 00151 void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex); 00152 QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes); 00153 00154 FinleyElements_ptr reducedElements; 00155 FinleyNodes_ptr nodeMesh; 00156 FinleyNodes_ptr originalMesh; 00157 std::string name; 00158 int numElements; 00159 int numGhostElements; 00160 int nodesPerElement; 00161 ZoneType type; 00162 Finley_ElementTypeId finleyTypeId; 00163 IntVec nodes; 00164 IntVec color, ID, tag; 00165 IntVec owner; 00166 QuadMaskInfo quadMask, reducedQuadMask; 00167 int elementFactor; 00168 }; 00169 00170 } // namespace weipa 00171 00172 #endif // __WEIPA_FINLEYELEMENTS_H__ 00173