00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
00043
00044 class ExodusWriter : public FieldWriterBase
00045 {
00046 public:
00047
00048 ExodusWriter(const std::string& filename)
00049 : FieldWriterBase(filename) {;}
00050
00051
00052 virtual ~ExodusWriter(){;}
00053
00054
00055 virtual void write() const ;
00056
00057
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
00123
00124
00125 class ExodusWriterFactory : public FieldWriterFactoryBase
00126 {
00127 public:
00128
00129 ExodusWriterFactory() {}
00130
00131
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