36 #include "Hdf5ToMeshalyzerConverter.hpp" 37 #include "MeshalyzerMeshWriter.hpp" 38 #include "GenericMeshReader.hpp" 42 #include "ReplicatableVector.hpp" 43 #include "DistributedVector.hpp" 44 #include "DistributedVectorFactory.hpp" 45 #include "Version.hpp" 47 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
51 std::string filename =
"";
52 if (this->mDatasetNames[this->mOpenDatasetIndex] ==
"Data")
54 filename += this->mFileBaseName +
"_";
56 filename += type +
".dat";
58 out_stream p_file = out_stream(
nullptr);
61 p_file = this->mpOutputFileHandler->OpenOutputFile(filename);
64 if (this->mPrecision != 0)
66 p_file->precision(this->mPrecision);
70 unsigned num_nodes = this->mpReader->GetNumberOfRows();
71 unsigned num_timesteps = this->mpReader->GetUnlimitedDimensionValues().size();
77 for (
unsigned time_step=0; time_step<num_timesteps; time_step++)
79 this->mpReader->GetVariableOverNodes(data, type, time_step);
82 assert(repl_data.
GetSize() == num_nodes);
86 for (
unsigned i=0; i<num_nodes; i++)
88 *p_file << repl_data[i] <<
"\n";
101 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
103 const std::string& rFileBaseName,
105 bool usingOriginalNodeOrdering,
107 :
AbstractHdf5Converter<ELEMENT_DIM,SPACE_DIM>(rInputDirectory, rFileBaseName, pMesh,
"output", precision)
111 std::vector<std::string> variable_names = this->
mpReader->GetVariableNames();
112 for (
unsigned i=0; i<variable_names.size(); i++)
114 Write(variable_names[i]);
131 if (!usingOriginalNodeOrdering || !this->
mpMesh->IsMeshOnDisk())
141 std::string original_file = this->
mpMesh->GetMeshFileBaseName();
142 std::shared_ptr<AbstractMeshReader<ELEMENT_DIM, SPACE_DIM> > p_original_mesh_reader
143 = GenericMeshReader<ELEMENT_DIM, SPACE_DIM>(original_file);
std::string mRelativeSubdirectory
boost::shared_ptr< Hdf5DataReader > mpReader
void WriteFilesUsingMeshReader(AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
void ReplicatePetscVector(Vec vec)
bool MoveOntoNextDataset()
Hdf5ToMeshalyzerConverter(const FileFinder &rInputDirectory, const std::string &rFileBaseName, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, bool usingOriginalNodeOrdering, unsigned precision=0)
static std::string GetProvenanceString()
virtual void WriteFilesUsingMesh(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
std::string GetRelativePath(const FileFinder &rBasePath) const
void Write(std::string type)