void avtGGCMFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md, int timeState) { std::string meshname = "GGCM mesh"; avtMeshType mt = AVT_RECTILINEAR_MESH; int nblocks = 1; /* must be 1 since this is an MTSD type dataset */ int block_origin = 0; int spatial_dimension = 3; int topological_dimension = 3; double *extents = NULL; /** tell the MD object that we have a mesh */ AddMeshToMetaData(md, meshname, mt, extents, nblocks, block_origin, spatial_dimension, topological_dimension); avtCentering cent = AVT_NODECENT; /* node centered */ int vector_dim = 3; /* 3 dimensional field */ /* for large files, reading the metadata can actually take some time, for * technical reasons I won't expound. On my system (7200rpm drives), * reading the metadata for a gigabyte file takes ~ 5 sec. */ MHDdata *metadata = ggcm_read_metadata(this->GetFilename()); std::vector<std::string> vectors; vectors = DeriveVectors(metadata); std::vector<std::string>::const_iterator iter; debug5 << vectors.size() << " vectors found in " << this->GetFilename() << std::endl; for(iter = vectors.begin(); iter != vectors.end(); iter++) { AddVectorVarToMetaData(md, (*iter).c_str(), meshname, cent, vector_dim); } std::vector<std::string> scalars; scalars = DeriveScalars(metadata); debug5 << scalars.size() << " scalars found in " << this->GetFilename() << std::endl; for(iter = scalars.begin(); iter != scalars.end(); iter++) { AddScalarVarToMetaData(md, (*iter).c_str(), meshname, cent); } }
void avtAdventureFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md) { Initialize(); // Add a mesh. std::string meshname = "mesh"; int cellType = 0; avtMeshMetaData *mmd = new avtMeshMetaData; mmd->name = meshname; mmd->meshType = AVT_UNSTRUCTURED_MESH; mmd->spatialDimension = 3; mmd->topologicalDimension = 3; mmd->blockOrigin = 0; mmd->groupOrigin = 0; mmd->cellOrigin = 0; mmd->blockPieceName = "domain"; mmd->blockTitle = "domains"; if(usingAdvData) { mmd->numBlocks = advData.GetNumDomains(); // Get the metadata from the ADV files. AdvDataSet::VarInfoVector vars; AdvDataSet::AdvElementType elementType; advData.GetMetaData(vars, elementType); if(elementType == AdvDataSet::ADVENTURE_ELEMENT_TET4) cellType = 0; else if(elementType == AdvDataSet::ADVENTURE_ELEMENT_TET10) cellType = 1; else cellType = 2; // Add variables that live on the mesh. for(size_t i = 0; i < vars.size(); ++i) { int ncomps = 1; if(vars[i].CheckFormat(ncomps)) { if(vars[i].fega_type == "AllElementConstant" || vars[i].fega_type == "AllElementVariable") { if(ncomps == 1) AddScalarVarToMetaData(md, vars[i].label, meshname, AVT_ZONECENT); else if(ncomps == 3) AddVectorVarToMetaData(md, vars[i].label, meshname, AVT_ZONECENT); else if(ncomps == 6) AddSymmetricTensorVarToMetaData(md, vars[i].label, meshname, AVT_ZONECENT, 6); } else if(vars[i].fega_type == "AllNodeConstant" || vars[i].fega_type == "AllNodeVariable") { // Skip node indexing variables since they are a little special. if(vars[i].label == "NodeIndex_PartToGlobal" || vars[i].label == "NodeIndex_SubdomainToPart") continue; if(ncomps == 1) AddScalarVarToMetaData(md, vars[i].label, meshname, AVT_NODECENT); else if(ncomps == 3) AddVectorVarToMetaData(md, vars[i].label, meshname, AVT_NODECENT); else if(ncomps == 6) AddSymmetricTensorVarToMetaData(md, vars[i].label, meshname, AVT_NODECENT, 6); } } } } else { mmd->numBlocks = mshData.GetNumDomains(); cellType = mshData.GetCellType(); } md->Add(mmd); // Store the cell type in the database comment so we know what it was. if(cellType == 0) md->SetDatabaseComment("Tet4 mesh"); else if(cellType == 1) md->SetDatabaseComment("Tet10 mesh"); else md->SetDatabaseComment("Hex8 mesh"); }
void avtPICS_TesterFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md, int timestate) { std::string meshname = "mesh"; avtMeshType meshtype = AVT_RECTILINEAR_MESH; if (! isRectilinear) meshtype = AVT_UNSTRUCTURED_MESH; double extents[6]; extents[0] = 0; extents[1] = global_extents[0]; extents[2] = 0; extents[3] = global_extents[1]; extents[4] = 0; extents[5] = global_extents[2]; int nblocks = 1; for( int i=0; i<rank; ++i ) nblocks *= numBlocks[i][timestate]; int block_origin = 0; int spatial_dimension = rank; int topological_dimension = rank; int bounds[3] = {numCells[0][timestate]+1, numCells[1][timestate]+1, numCells[2][timestate]+1}; if (rank == 2) bounds[2] = 1; avtMeshMetaData *mesh = new avtMeshMetaData; mesh->name = meshname; mesh->meshType = meshtype; mesh->numBlocks = nblocks; mesh->blockOrigin = block_origin; mesh->cellOrigin = 0; mesh->spatialDimension = spatial_dimension; mesh->topologicalDimension = topological_dimension; mesh->blockTitle = "blocks"; mesh->blockPieceName = "block"; mesh->SetBounds(bounds); mesh->hasLogicalBounds = true; mesh->SetExtents(extents); mesh->hasSpatialExtents = true; mesh->containsGhostZones = AVT_NO_GHOSTS; md->Add(mesh); std::string varname = "velocity"; int vector_dim = spatial_dimension; avtCentering cent = AVT_NODECENT; AddVectorVarToMetaData(md, varname, meshname, cent, vector_dim); md->SetTimes(times); md->SetTimesAreAccurate(true); md->SetCycles(cycles); md->SetCyclesAreAccurate(true); md->SetTemporalExtents(times[0], times[times.size()-1]); md->SetHasTemporalExtents(true); // Find logical domain boundaries if (!avtDatabase::OnlyServeUpMetaData() && nblocks > 1) { avtRectilinearDomainBoundaries *rdb = new avtRectilinearDomainBoundaries(true); rdb->SetNumDomains(nblocks); int bbox[6]; for (int domain = 0; domain < (size_t)nblocks ; ++domain) { int xOff = domain % numBlocks[0][timestate]; int yOff = (domain/numBlocks[0][timestate]) % numBlocks[1][timestate]; int zOff = domain/(numBlocks[0][timestate]*numBlocks[1][timestate]); bbox[0] = (xOff ) * numCells[0][timestate]; bbox[1] = (xOff + 1) * numCells[0][timestate]; bbox[2] = (yOff ) * numCells[1][timestate]; bbox[3] = (yOff + 1) * numCells[1][timestate]; // VisIt expects the 2d case to have flat logical z extent (0,0). if(rank == 2) { bbox[4] = 0; bbox[5] = 0; } else // if(rank == 3) { bbox[4] = (zOff ) * numCells[2][timestate]; bbox[5] = (zOff + 1) * numCells[2][timestate]; } rdb->SetIndicesForRectGrid(domain, bbox); } rdb->CalculateBoundaries(); void_ref_ptr vr = void_ref_ptr(rdb, avtRectilinearDomainBoundaries::Destruct); cache->CacheVoidRef("any_mesh", AUXILIARY_DATA_DOMAIN_BOUNDARY_INFORMATION, timestate, -1, vr); } }