SundanceExodusWriter.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_EXODUSWRITER_H
00032 #define SUNDANCE_EXODUSWRITER_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceFieldWriterBase.hpp"
00037 #include "SundanceCellType.hpp"
00038 
00039 namespace Sundance
00040 {
00041 /**
00042  * ExodusWriter writes a mesh or fields to an ExodusII file
00043  */
00044 class ExodusWriter : public FieldWriterBase
00045 {
00046 public:
00047   /** */
00048   ExodusWriter(const std::string& filename) 
00049     : FieldWriterBase(filename) {;}
00050     
00051   /** virtual dtor */
00052   virtual ~ExodusWriter(){;}
00053 
00054   /** */
00055   virtual void write() const ;
00056 
00057   /** Return a ref count pointer to self */
00058   virtual RCP<FieldWriterBase> getRcp() {return rcp(this);}
00059 
00060   /** */
00061   void writeParallelInfo(const std::string& filename) const ;
00062 
00063 
00064 private:    
00065   /** */
00066   void getCharpp(const Array<std::string>& s, Array<const char*>& p) const ;
00067 
00068   /** */
00069   void findNodeSets(
00070     Array<CellFilter>& nodesetFilters,
00071     Array<int>& omnipresentFuncs,
00072     Array<RCP<Array<int> > >& funcsForNodeset,
00073     Array<RCP<Array<int> > >& nodesForNodeset,
00074     Array<int>& nsID,
00075     Array<int>& nNodesPerSet,
00076     Array<int>& nsNodePtr,
00077     RCP<Array<int> > allNodes
00078     ) const ;
00079 
00080   /** */
00081   void findBlocks(
00082     Array<CellFilter>& blockFilters,
00083     Array<int>& omnipresentFuncs,
00084     Array<RCP<Array<int> > >& funcsForBlock,
00085     Array<RCP<Array<int> > >& elemsForBlock,
00086     Array<int>& elemIDs,
00087     Array<int>& nElemsPerBlock,
00088     Array<int>& blockElemPtr,
00089     RCP<Array<int> > allElems
00090     ) const ;
00091 
00092 
00093 
00094   /** */
00095   void offset(Array<int>& x) const ;
00096 
00097   /** */
00098   std::string elemType(const CellType& type) const ;
00099 
00100   /** */
00101   void writeMesh(int exoID, 
00102     const Array<CellFilter>& nodesetFilters,
00103     const Array<int>& nsID,
00104     const Array<int>& nNodesPerSet,
00105     const Array<int>& nsNodePtr,
00106     const RCP<Array<int> >& allNodes) const ;
00107 
00108   /** */
00109   void writeFields(int exoID, 
00110     const Array<CellFilter>& nodesetFilters,
00111     const Array<int>& omnipresentNodalFuncs,
00112     const Array<int>& omnipresentElemFuncs,
00113     const Array<RCP<Array<int> > >& funcsForNodeset,
00114     const Array<RCP<Array<int> > >& nodesForNodeset,
00115     const Array<int>& nsID) const ;
00116     
00117     
00118 };
00119 
00120 
00121 /** 
00122  * ExodusWriterFactory produces an Exodus writer in contexts where a user cannot
00123  * do so directly.
00124  */
00125 class ExodusWriterFactory : public FieldWriterFactoryBase
00126 {
00127 public:
00128   /** */
00129   ExodusWriterFactory() {}
00130 
00131   /** Create a writer with the specified filename */
00132   RCP<FieldWriterBase> createWriter(const string& name) const 
00133     {return rcp(new ExodusWriter(name));}
00134 
00135   /** */
00136   virtual RCP<FieldWriterFactoryBase> getRcp() {return rcp(this);}
00137   
00138 };
00139 
00140 }
00141 
00142 
00143 #endif

Site Contact