vtkDataSet * avtAdventureFileFormat::GetMesh(int domain, const char *meshname) { Initialize(); vtkDataSet *retval = 0; if(usingAdvData) { // Get the mesh retval = advData.GetMesh(domain); // If we have global node ids on the mesh then put them in the cache too. vtkDataArray *globalNodeId = retval->GetPointData()->GetArray("avtGlobalNodeId"); if(globalNodeId != 0) { globalNodeId->Register(NULL); void_ref_ptr vr = void_ref_ptr(globalNodeId, avtVariableCache::DestructVTKObject); cache->CacheVoidRef(meshname, AUXILIARY_DATA_GLOBAL_NODE_IDS, timestep, domain, vr); } // We could do the same thing with global zone ids here. I'm not doing it // right now because my test data seems to have shoddy global zone ids. } else retval = mshData.GetMesh(domain); return retval; }
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); } }