escript  Revision_
FinleyNodes.h
Go to the documentation of this file.
00001 
00002 /*****************************************************************************
00003 *
00004 * Copyright (c) 2003-2014 by University of Queensland
00005 * http://www.uq.edu.au
00006 *
00007 * Primary Business: Queensland, Australia
00008 * Licensed under the Open Software License version 3.0
00009 * http://www.opensource.org/licenses/osl-3.0.php
00010 *
00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
00012 * Development 2012-2013 by School of Earth Sciences
00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
00014 *
00015 *****************************************************************************/
00016 
00017 #ifndef __WEIPA_FINLEYNODES_H__
00018 #define __WEIPA_FINLEYNODES_H__
00019 
00020 #include <weipa/NodeData.h>
00021 
00022 class DBfile;
00023 class NcFile;
00024 struct Dudley_NodeFile;
00025 namespace finley {
00026     class NodeFile;
00027 }
00028 
00029 namespace weipa {
00030 
00031 class FinleyNodes;
00032 typedef boost::shared_ptr<FinleyNodes> FinleyNodes_ptr;
00033 
00039 class FinleyNodes : public NodeData
00040 {
00041 public:
00043     FinleyNodes(const std::string& meshName);
00044 
00045     FinleyNodes(FinleyNodes_ptr fullNodes, IntVec& requiredNodes,
00046                 const std::string& meshName);
00047 
00049     FinleyNodes(const FinleyNodes& m);
00050 
00052     virtual ~FinleyNodes();
00053 
00055     bool initFromDudley(const Dudley_NodeFile* dudleyFile);
00056 
00058     bool initFromFinley(const finley::NodeFile* finleyFile);
00059 
00061     bool readFromNc(NcFile* ncFile);
00062 
00064     bool writeToSilo(DBfile* dbfile);
00065 
00067     virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
00068 
00070     void setSiloPath(const std::string& path) { siloPath = path; }
00071 
00075     const IntVec& getVarDataByName(const std::string& name) const;
00076 
00078     virtual StringVec getVarNames() const;
00079 
00081     virtual std::string getName() const { return name; }
00082 
00084     std::string getFullSiloName() const;
00085 
00087     virtual const IntVec& getNodeIDs() const { return nodeID; }
00088 
00090     virtual const IntVec& getNodeDistribution() const { return nodeDist; }
00091 
00093     virtual const IntVec& getGlobalNodeIndices() const { return nodeGNI; }
00094 
00096     virtual const CoordArray& getCoords() const { return coords; }
00097 
00099     virtual int getNumDims() const { return numDims; }
00100 
00102     virtual int getNumNodes() const { return numNodes; }
00103 
00105     virtual int getGlobalNumNodes() const;
00106 
00107 protected:
00108     CoordArray coords;     
00109     int numDims;           
00110     int numNodes;          
00111     IntVec nodeID;         
00112     IntVec nodeTag, nodeGDOF, nodeGNI, nodeGRDFI, nodeGRNI;
00113     IntVec nodeDist;       
00114     std::string name;      
00115     std::string siloPath;  
00116 };
00117 
00118 
00119 inline std::string FinleyNodes::getFullSiloName() const
00120 {
00121     std::string result(siloPath);
00122     if (result.length() == 0 || *result.rbegin() != '/')
00123         result += '/';
00124     result += name;
00125     return result;
00126 }
00127 
00128 } // namespace weipa
00129 
00130 #endif // __WEIPA_FINLEYNODES_H__
00131