50 const std::string& rFileBaseName,
53 bool usingOriginalNodeOrdering)
54 :
AbstractHdf5Converter<ELEMENT_DIM,SPACE_DIM>(rInputDirectory, rFileBaseName, pMesh,
"vtk_output",0u)
75 if (p_distributed_mesh ==
nullptr)
77 WARNING(
"Can only write parallel VTK from a DistributedTetrahedralMesh - writing sequential VTK instead");
82 if (usingOriginalNodeOrdering)
84 WARNING(
"Can't write parallel VTK (pvtu) files with original ordering - writing sequential VTK instead");
103 unsigned num_timesteps = this->
mpReader->GetUnlimitedDimensionValues().size();
106 for (
unsigned time_step=0; time_step<num_timesteps; time_step++)
109 for (
unsigned variable=0; variable<this->
mNumVariables; variable++)
111 std::string variable_name = this->
mpReader->GetVariableNames()[variable];
114 this->
mpReader->GetVariableOverNodes(data, variable_name, time_step);
116 std::vector<double> data_for_vtk;
117 data_for_vtk.resize(num_nodes);
118 std::ostringstream variable_point_data_name;
119 variable_point_data_name << variable_name <<
"_" << std::setw(6) << std::setfill(
'0') << time_step;
125 VecGetArray(data, &p_data);
126 for (
unsigned index=0; index<num_nodes; index++)
128 data_for_vtk[index] = p_data[index];
130 VecRestoreArray(data, &p_data);
136 for (
unsigned index=0; index<num_nodes; index++)
138 data_for_vtk[index] = repl_data[index];
142 vtk_writer.
AddPointData(variable_point_data_name.str(), data_for_vtk);
152 if (!usingOriginalNodeOrdering)
161 std::string original_file = this->
mpMesh->GetMeshFileBaseName();
162 std::shared_ptr<AbstractMeshReader<ELEMENT_DIM, SPACE_DIM> > p_original_mesh_reader
163 = GenericMeshReader<ELEMENT_DIM, SPACE_DIM>(original_file);
Hdf5ToVtkConverter(const FileFinder &rInputDirectory, const std::string &rFileBaseName, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, bool parallelVtk, bool usingOriginalNodeOrdering)