Esempio n. 1
0
/*!  
 *  Reads meta data of VTU file (grid size, data fields, codex, position of data within file).
 *  Calls setDimension.
 */
void VTKUnstructuredGrid::readMetaData( ){

    std::fstream str;
    std::string line, temp;

    std::fstream::pos_type        position;

    str.open( fh.getPath( ), std::ios::in ) ;

    getline( str, line);
    while( ! bitpit::utils::keywordInString( line, "<VTKFile")){
        getline(str, line);
    };

    if( bitpit::utils::getAfterKeyword( line, "header_type", '\"', temp) ){
        setHeaderType( temp) ;
    };

    while( ! bitpit::utils::keywordInString( line, "<Piece")){
        getline(str, line);
    };

    bitpit::utils::getAfterKeyword( line, "NumberOfPoints", '\"', temp) ;
    bitpit::utils::convertString( temp, nr_points );

    bitpit::utils::getAfterKeyword( line, "NumberOfCells", '\"', temp) ;
    bitpit::utils::convertString( temp, nr_cells );


    position = str.tellg() ;
    readDataHeader( str ) ;


    for( auto &field : geometry ){ 
        str.seekg( position) ;
        if( ! readDataArray( str, *field ) ) {
            std::cout << field->getName() << " DataArray not found" << std::endl ;
        };
    };


    str.close() ;

    if( homogeneousType == VTKElementType::UNDEFINED) {
        setDimensions( nr_cells, nr_points, calcSizeConnectivity() ) ;
    } else {
        setDimensions( nr_cells, nr_points ) ;
    };


    return ;
};
Esempio n. 2
0
/*!  
 *  Reads meta data of VTR file (grid size, data fields, codex, position of data within file).
 *  Calls setDimension.
 */
void VTKRectilinearGrid::readMetaData( ){

    std::fstream str;
    std::string line, temp;

    std::fstream::pos_type        position;
    std::array<int,6>             extensions ;


    str.open( fh.getPath( ), std::ios::in ) ;

    getline( str, line);
    while( ! bitpit::utils::keywordInString( line, "<VTKFile")){
        getline(str, line);
    };

    if( bitpit::utils::getAfterKeyword( line, "header_type", '\"', temp) ){
        setHeaderType( temp) ;
    };

    while( ! bitpit::utils::keywordInString( line, "<Piece")){
        getline(str, line);
    };

    bitpit::utils::getAfterKeyword( line, "Extent", '\"', temp) ;
    bitpit::utils::convertString( temp, extensions );

    local_index[0][0] = extensions[0] ;
    local_index[0][1] = extensions[1] ;
    local_index[1][0] = extensions[2] ;
    local_index[1][1] = extensions[3] ;
    local_index[2][0] = extensions[4] ;
    local_index[2][1] = extensions[5] ;

    position = str.tellg() ;

    readDataHeader( str ) ;

    for( auto &field : geometry ){ //int i=0; i<geometry.size(); ++i){
        str.seekg( position) ;
        if( ! readDataArray( str, *field ) ) {
            std::cout << field->getName() << " DataArray not found" << std::endl ;
        };
    };


    setDimensions( local_index[0][0], local_index[0][1], local_index[1][0], local_index[1][1], local_index[2][0], local_index[2][1] ) ;
    str.close() ; 

    return ;

};
Esempio n. 3
0
bool seissol::checkpoint::mpio::Wavefield::init(real* dofs, unsigned int numDofs)
{
	seissol::checkpoint::Wavefield::init(dofs, numDofs);

	// Create the header data type
	MPI_Datatype headerType;
	int blockLength[] = {1, 1, 1, 1};
	MPI_Aint displ[] = {offsetof(Header, identifier), offsetof(Header, partitions),
			offsetof(Header, time), offsetof(Header, timestepWavefield)};
	MPI_Datatype types[] = {MPI_UNSIGNED_LONG, MPI_INT, MPI_DOUBLE, MPI_INT};
	MPI_Type_create_struct(4, blockLength, displ, types, &headerType);
	setHeaderType(headerType);

	// Define the file view
	defineFileView(sizeof(Header), numDofs);

	return exists();
}
Esempio n. 4
0
bool seissol::checkpoint::mpio::Wavefield::init(size_t headerSize, unsigned long numDofs, unsigned int groupSize)
{
	seissol::checkpoint::Wavefield::init(headerSize, numDofs, groupSize);

	// Create the header data type
	// We cannot use header since this will be called on I/O nodes as well
	MPI_Datatype headerType;
	MPI_Type_contiguous(headerSize, MPI_BYTE, &headerType);
	setHeaderType(headerType);

	// Define the file view
	defineFileView(headerSize, sizeof(real), numDofs);

	// Large buffers are supported?
	m_useLargeBuffer = utils::Env::get<int>("SEISSOL_CHECKPOINT_MPIO_LARGE_BUFFER", 1) != 0;

	return exists();
}