55 field.setLocation( VTKLocation::POINT ) ;
56 field.setFieldType( VTKFieldType::SCALAR ) ;
57 field.setDataType( VTKDataType::Float64 ) ;
61 for (
int k = 0; k < 3; ++k) {
169 std::string line, temp;
171 std::fstream::pos_type position;
172 std::array<int,6> extensions ;
200 position = str.tellg() ;
206 str.seekg( position) ;
208#if BITPIT_ENABLE_DEBUG
209 log::cout() <<
"Geometry field " << field.
getName() <<
" not found, it will be disabled" << std::endl ;
229 if (!str.is_open()) {
230 throw std::runtime_error(
"Cannot create file \"" +
m_fh.
getName() +
"\"" +
" inside the directory \"" +
m_fh.
getDirectory() +
"\"");
234 str <<
"<?xml version=\"1.0\"?>" << std::endl;
237 str <<
"<VTKFile type=\"RectilinearGrid\" version=\"0.1\" byte_order=\"LittleEndian\" header_type=\"" <<
m_headerType <<
"\">" << std::endl;
238 str <<
" <RectilinearGrid WholeExtent= \""
242 <<
"\" >" << std::endl;
244 str <<
" <Piece Extent= \" "
248 <<
"\" >" << std::endl;
256 str <<
" <Coordinates>" << std::endl;
260 str <<
" </Coordinates>" << std::endl;
263 str <<
" </Piece>" << std::endl;
264 str <<
" </RectilinearGrid>" << std::endl;
268 str <<
" <AppendedData encoding=\"raw\">" << std::endl;
269 str <<
"_" << std::endl;
273 str <<
"</VTKFile>" << std::endl;
297 str.open( fhp.
getPath( ), std::ios::out ) ;
298 if (!str.is_open()) {
299 throw std::runtime_error(
"Cannot create file \"" + fhp.
getName() +
"\"" +
" inside the directory \"" + fhp.
getDirectory() +
"\"");
303 str <<
"<?xml version=\"1.0\"?>" << std::endl;
306 str <<
"<VTKFile type=\"PRectilinearGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << std::endl;
307 str <<
" <PRectilinearGrid WholeExtent= \""
311 <<
"GhostLevel=\"0\">" << std::endl;
319 str <<
" <PCoordinates>" << std::endl;
323 str <<
" </PCoordinates>" << std::endl;
334 str <<
" <Piece Extent= \" "
335 << index[0][0] <<
" " << index[0][1] <<
" "
336 << index[1][0] <<
" " << index[1][1] <<
" "
337 << index[2][0] <<
" " << index[2][1] <<
" "
338 <<
"\" Source= \"" << fho.
getPath() <<
"\"/>" << std::endl;
341 str <<
" </PRectilinearGrid>" << std::endl;
342 str <<
"</VTKFile>" << std::endl;
442 int index =
static_cast<int>(fieldEnum) ;
474 log::cout() <<
"Size of loc_ in VTKRectilinearGrid::setParallelIndex does not fit m_procs " << std::endl ;
487 if( loc.size() !=
m_procs )
log::cout() <<
"Size of loc_ in VTKRectilinearGrid::setParallelIndex does not fit m_procs " << std::endl ;
491 for(
int i=0; i<
m_procs; ++i){
520 uint64_t entries(0) ;
521 const std::string &name = field.
getName() ;
523 if( name ==
"x_Coord" ){
526 }
else if( name ==
"y_Coord" ){
529 }
else if( name ==
"z_Coord" ){
535 assert( location != VTKLocation::UNDEFINED) ;
537 if( location == VTKLocation::CELL ){
540 }
else if( location == VTKLocation::POINT ){
561 const std::string &name = field.
getName() ;
563 if( name ==
"x_Coord" || name ==
"y_Cooord" || name ==
"z_Coord" ){
Creates file names and checks status.
std::string getPath() const
const std::string & getDirectory() const
void setDirectory(const std::string &d_)
void setName(const std::string &n_)
const std::string & getName() const
void setAppendix(const std::string &a_)
std::string getName() const
The base class to be used to derive VTK streamers form.
VTKField handles geometry and data field information for the VTK format.
const std::string & getName() const
VTKLocation getLocation() const
void setStreamer(VTKBaseStreamer &)
static unsigned getComponentCount(VTKFieldType fieldType)
VTKDataType getDataType() const
VTK input output for Rectilinear Meshes.
std::vector< extension3D_t > m_procIndex
void setGlobalDimensions(int, int, int)
void setDimensions(int, int, int, int, int, int)
uint8_t calcFieldComponents(const VTKField &) const override
extension3D_t m_globalIndex
void setGeomData(VTKRectilinearField, std::vector< T > &)
std::string getExtension() const override
void writeMetaInformation() const override
extension3D_t m_localIndex
uint64_t calcFieldSize(const VTKField &) const override
void setGlobalIndex(const std::vector< extension3D_t > &)
uint64_t calcFieldEntries(const VTKField &) const override
void readMetaInformation() override
static uint8_t sizeOfType(VTKDataType type)
A base class for VTK input output.
std::vector< VTKField > m_geometry
void readDataHeader(std::fstream &)
void setNames(const std::string &, const std::string &)
void setHeaderType(const std::string &)
bool readDataArray(std::fstream &, VTKField &) const
void writeCollection() const
void setGeomCodex(VTKFormat)
void writePDataArray(std::fstream &, const VTKField &) const
void writeDataHeader(std::fstream &, bool parallel=false) const
bool isAppendedActive() const
void writeDataArray(std::fstream &, const VTKField &) const
FileHandler createCollectionHandler(const std::string &collectionName) const
bool keywordInString(const std::string &line, const std::string &key)
void convertString(std::string input, T &output)
bool getAfterKeyword(const std::string &line, const std::string &key, char del, std::string &result)
Logger & cout(log::Level defaultSeverity, log::Visibility defaultVisibility)