diff --git a/src/constitutive_relations/column_integrators/EvaluatorColumnIntegrator.hh b/src/constitutive_relations/column_integrators/EvaluatorColumnIntegrator.hh index 0356e6380..a515e5e66 100644 --- a/src/constitutive_relations/column_integrators/EvaluatorColumnIntegrator.hh +++ b/src/constitutive_relations/column_integrators/EvaluatorColumnIntegrator.hh @@ -83,9 +83,9 @@ EvaluatorColumnIntegrator::EnsureCompatibility_ToDeps_(State my_keys_.front().second); if (fac.Mesh() != Teuchos::null) { CompositeVectorSpace dep_fac; - dep_fac.SetMesh(fac.Mesh()->parent()) + dep_fac.SetMesh(fac.Mesh()->getParentMesh()) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); for (const auto& dep : dependencies_) { if (Keys::getDomain(dep.first) == Keys::getDomain(my_keys_.front().first)) { @@ -122,7 +122,7 @@ EvaluatorColumnIntegrator::Evaluate_( deps.emplace_back( S.Get(dep.first, dep.second).ViewComponent("cell", false).get()); } - auto mesh = result[0]->Mesh()->parent(); + auto mesh = result[0]->Mesh()->getParentMesh(); Integrator integrator(plist_, deps, &*mesh); Epetra_MultiVector& res = *result[0]->ViewComponent("cell", false); @@ -131,7 +131,7 @@ EvaluatorColumnIntegrator::Evaluate_( // for each column, loop over cells calling the integrator until stop is // requested or the column is complete AmanziGeometry::Point val(0., 0.); - auto& col_cell = mesh->cells_of_column(col); + auto col_cell = mesh->columns.getCells(col); for (int i = 0; i != col_cell.size(); ++i) { bool completed = integrator.scan(col, col_cell[i], val); if (completed) break; diff --git a/src/constitutive_relations/column_integrators/activelayer_average_temp_evaluator.cc b/src/constitutive_relations/column_integrators/activelayer_average_temp_evaluator.cc index 527ccbda1..c2320db50 100644 --- a/src/constitutive_relations/column_integrators/activelayer_average_temp_evaluator.cc +++ b/src/constitutive_relations/column_integrators/activelayer_average_temp_evaluator.cc @@ -40,7 +40,7 @@ IntegratorActiveLayerAverageTemp::scan(AmanziMesh::Entity_ID col, AmanziGeometry::Point& p) { if ((*temp_)[0][c] >= trans_temp_) { - double cv = mesh_->cell_volume(c); + double cv = mesh_->getCellVolume(c); p[0] += (*temp_)[0][c] * cv; p[1] += cv; return false; diff --git a/src/constitutive_relations/generic_evaluators/ExtractionEvaluator.cc b/src/constitutive_relations/generic_evaluators/ExtractionEvaluator.cc index ec57c345a..2996b11ba 100644 --- a/src/constitutive_relations/generic_evaluators/ExtractionEvaluator.cc +++ b/src/constitutive_relations/generic_evaluators/ExtractionEvaluator.cc @@ -52,7 +52,7 @@ ExtractionEvaluator::Evaluate_(const State& S, const std::vectorentity_get_parent(entity, i)]; + result_c[j][i] = parent_vector_c[j][mesh->getEntityParent(entity, i)]; } } } diff --git a/src/constitutive_relations/generic_evaluators/SubgridAggregateEvaluator.cc b/src/constitutive_relations/generic_evaluators/SubgridAggregateEvaluator.cc index 137dcb85a..0db532695 100644 --- a/src/constitutive_relations/generic_evaluators/SubgridAggregateEvaluator.cc +++ b/src/constitutive_relations/generic_evaluators/SubgridAggregateEvaluator.cc @@ -46,7 +46,7 @@ SubgridAggregateEvaluator::Evaluate_(const State& S, const std::vector(dep->first, dep->second).ViewComponent("cell", false).get()); ++dep; } - ds->DoImport(sources, result_v); + ds->doImport(sources, result_v); } void @@ -65,7 +65,7 @@ SubgridAggregateEvaluator::EnsureEvaluators(State& S) if (dependencies_.size() == 0) { auto ds = S.GetDomainSet(source_domain_); Tag dep_tag = Keys::readTag(plist_, my_keys_.front().second); - if (ds->get_referencing_parent() == Teuchos::null) { + if (ds->getReferencingParent() == Teuchos::null) { Errors::Message msg; msg << "SubgridAggregateEvaluator: DomainSet \"" << source_domain_ << "\" does not have a referencing parent but must have one to aggregate."; @@ -92,8 +92,8 @@ SubgridAggregateEvaluator::EnsureCompatibility_Structure_(State& S) if (dep_fac.HasComponent("cell")) { S.Require(my_keys_.front().first, my_keys_.front().second) - .SetMesh(ds->get_referencing_parent()) - ->AddComponent("cell", AmanziMesh::CELL, dep_fac.NumVectors("cell")); + .SetMesh(ds->getReferencingParent()) + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, dep_fac.NumVectors("cell")); } if (S.GetRecordSet(dependencies_.front().first).subfieldnames()) { @@ -116,7 +116,7 @@ SubgridAggregateEvaluator::EnsureCompatibility_ToDeps_(State& S) "cell", }, { - AmanziMesh::CELL, + AmanziMesh::Entity_kind::CELL, }, { num_vectors, diff --git a/src/constitutive_relations/generic_evaluators/SubgridDisaggregateEvaluator.cc b/src/constitutive_relations/generic_evaluators/SubgridDisaggregateEvaluator.cc index b2c4c2540..e4176786f 100644 --- a/src/constitutive_relations/generic_evaluators/SubgridDisaggregateEvaluator.cc +++ b/src/constitutive_relations/generic_evaluators/SubgridDisaggregateEvaluator.cc @@ -39,7 +39,7 @@ SubgridDisaggregateEvaluator::Evaluate_(const State& S, const std::vectorDoExport(domain_index_, + ds->doExport(domain_index_, *S.Get(source_key_, tag).ViewComponent("cell", false), *result[0]->ViewComponent("cell", false)); } @@ -64,7 +64,7 @@ SubgridDisaggregateEvaluator::EnsureCompatibility_ToDeps_(State& S) if (my_fac.HasComponent("cell")) { int num_vectors = my_fac.NumVectors("cell"); CompositeVectorSpace fac; - fac.SetMesh(S.GetMesh(source_domain_))->AddComponent("cell", AmanziMesh::CELL, num_vectors); + fac.SetMesh(S.GetMesh(source_domain_))->AddComponent("cell", AmanziMesh::Entity_kind::CELL, num_vectors); EvaluatorSecondaryMonotypeCV::EnsureCompatibility_ToDeps_(S, fac); } } diff --git a/src/constitutive_relations/surface_subsurface_fluxes/overland_source_from_subsurface_flux_evaluator.cc b/src/constitutive_relations/surface_subsurface_fluxes/overland_source_from_subsurface_flux_evaluator.cc index 292c16588..34a4f1973 100644 --- a/src/constitutive_relations/surface_subsurface_fluxes/overland_source_from_subsurface_flux_evaluator.cc +++ b/src/constitutive_relations/surface_subsurface_fluxes/overland_source_from_subsurface_flux_evaluator.cc @@ -77,24 +77,21 @@ OverlandSourceFromSubsurfaceFluxEvaluator::IdentifyFaceAndDirection_(const State Teuchos::RCP surface = S.GetMesh(domain_surf_); // allocate space for face IDs and directions - int ncells = surface->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells = surface->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); face_and_dirs_ = Teuchos::rcp(new std::vector(ncells)); for (int c = 0; c != ncells; ++c) { // Get the face on the subsurface mesh corresponding to the cell // of the surface mesh. - AmanziMesh::Entity_ID domain_face = surface->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID domain_face = surface->getEntityParent(AmanziMesh::Entity_kind::CELL, c); // Get the direction corresponding to that face wrt its only cell. // -- get the cell - AmanziMesh::Entity_ID_List cells; - subsurface->face_get_cells(domain_face, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = subsurface->getFaceCells(domain_face, AmanziMesh::Parallel_kind::OWNED); AMANZI_ASSERT(cells.size() == 1); // -- Get directions - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; - subsurface->cell_get_faces_and_dirs(cells[0], &faces, &fdirs); + const auto& [faces, fdirs] = subsurface->getCellFacesAndDirections(cells[0]); int index = std::find(faces.begin(), faces.end(), domain_face) - faces.begin(); // Put (face,dir) into cached data. @@ -121,9 +118,8 @@ OverlandSourceFromSubsurfaceFluxEvaluator::Evaluate_(const State& S, int ncells = result[0]->size("cell", false); for (int c = 0; c != ncells; ++c) { - AmanziMesh::Entity_ID_List cells; - subsurface->face_get_cells( - (*face_and_dirs_)[c].first, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = subsurface->getFaceCells( + (*face_and_dirs_)[c].first, AmanziMesh::Parallel_kind::OWNED); AMANZI_ASSERT(cells.size() == 1); res_v[0][c] = @@ -132,9 +128,8 @@ OverlandSourceFromSubsurfaceFluxEvaluator::Evaluate_(const State& S, } else { int ncells = result[0]->size("cell", false); for (int c = 0; c != ncells; ++c) { - AmanziMesh::Entity_ID_List cells; - subsurface->face_get_cells( - (*face_and_dirs_)[c].first, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = subsurface->getFaceCells( + (*face_and_dirs_)[c].first, AmanziMesh::Parallel_kind::OWNED); AMANZI_ASSERT(cells.size() == 1); res_v[0][c] = flux[0][(*face_and_dirs_)[c].first] * (*face_and_dirs_)[c].second; diff --git a/src/constitutive_relations/surface_subsurface_fluxes/surface_top_cells_evaluator.cc b/src/constitutive_relations/surface_subsurface_fluxes/surface_top_cells_evaluator.cc index 86dca4c66..98d0ee7c0 100644 --- a/src/constitutive_relations/surface_subsurface_fluxes/surface_top_cells_evaluator.cc +++ b/src/constitutive_relations/surface_subsurface_fluxes/surface_top_cells_evaluator.cc @@ -49,14 +49,13 @@ SurfaceTopCellsEvaluator::Evaluate_(const State& S, const std::vectorMesh()->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + result[0]->Mesh()->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int c = 0; c != ncells_surf; ++c) { // get the face on the subsurface mesh - AmanziMesh::Entity_ID f = result[0]->Mesh()->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = result[0]->Mesh()->getEntityParent(AmanziMesh::Entity_kind::CELL, c); // get the cell interior to the face - AmanziMesh::Entity_ID_List cells; - sub_vector->Mesh()->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = sub_vector->Mesh()->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); result_cells[0][c] = sub_vector_cells[0][cells[0]]; @@ -70,7 +69,7 @@ SurfaceTopCellsEvaluator::EnsureCompatibility_ToDeps_(State& S) auto domain_name = Keys::getDomain(my_keys_.front().first); CompositeVectorSpace fac; - fac.SetMesh(S.GetMesh(domain_name)->parent())->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_name)->getParentMesh())->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); EvaluatorSecondaryMonotypeCV::EnsureCompatibility_ToDeps_(S, fac); } diff --git a/src/constitutive_relations/surface_subsurface_fluxes/top_cells_surface_evaluator.cc b/src/constitutive_relations/surface_subsurface_fluxes/top_cells_surface_evaluator.cc index ea12969ad..d0e99414a 100644 --- a/src/constitutive_relations/surface_subsurface_fluxes/top_cells_surface_evaluator.cc +++ b/src/constitutive_relations/surface_subsurface_fluxes/top_cells_surface_evaluator.cc @@ -48,14 +48,13 @@ TopCellsSurfaceEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("cell", false); int ncells_surf = - surf_vector->Mesh()->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + surf_vector->Mesh()->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int c = 0; c != ncells_surf; ++c) { // get the face on the subsurface mesh - AmanziMesh::Entity_ID f = surf_vector->Mesh()->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surf_vector->Mesh()->getEntityParent(AmanziMesh::Entity_kind::CELL, c); // get the cell interior to the face - AmanziMesh::Entity_ID_List cells; - result[0]->Mesh()->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = result[0]->Mesh()->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); result_cells[0][cells[0]] = surf_vector_cells[0][c]; @@ -68,7 +67,7 @@ void TopCellsSurfaceEvaluator::EnsureCompatibility_ToDeps_(State& S) { CompositeVectorSpace fac; - fac.SetMesh(S.GetMesh(domain_surf_))->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_surf_))->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); EvaluatorSecondaryMonotypeCV::EnsureCompatibility_ToDeps_(S, fac); } diff --git a/src/constitutive_relations/surface_subsurface_fluxes/volumetric_darcy_flux_evaluator.cc b/src/constitutive_relations/surface_subsurface_fluxes/volumetric_darcy_flux_evaluator.cc index b38587f3f..bb2d88592 100644 --- a/src/constitutive_relations/surface_subsurface_fluxes/volumetric_darcy_flux_evaluator.cc +++ b/src/constitutive_relations/surface_subsurface_fluxes/volumetric_darcy_flux_evaluator.cc @@ -64,10 +64,9 @@ Volumetric_FluxEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("face", false); const auto& mesh = *result[0]->Mesh(); - int nfaces_owned = mesh.num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); - AmanziMesh::Entity_ID_List cells; + int nfaces_owned = mesh.getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (int f = 0; f < nfaces_owned; f++) { - mesh.face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh.getFaceCells(f, AmanziMesh::Parallel_kind::ALL); double n_liq = 0.; for (int c = 0; c < cells.size(); c++) n_liq += molar_density[0][c]; n_liq /= cells.size(); diff --git a/src/executables/CMakeLists.txt b/src/executables/CMakeLists.txt index adf7e704f..f043d994f 100644 --- a/src/executables/CMakeLists.txt +++ b/src/executables/CMakeLists.txt @@ -88,7 +88,6 @@ set(amanzi_link_libs dbg data_structures mesh - mesh_audit mesh_functions functions geometry @@ -136,6 +135,7 @@ set(tpl_link_libs ${HYPRE_LIBRARIES} ${HDF5_LIBRARIES} ${CLM_LIBRARIES} + ${KOKKOS_LIBRARIES} ) add_amanzi_library(ats_executable diff --git a/src/executables/ats_mesh_factory.cc b/src/executables/ats_mesh_factory.cc index 1cbf62deb..e670b4aa8 100644 --- a/src/executables/ats_mesh_factory.cc +++ b/src/executables/ats_mesh_factory.cc @@ -19,7 +19,6 @@ #include "MeshAudit.hh" #include "MeshFactory.hh" #include "MeshLogicalFactory.hh" -#include "MeshColumn.hh" #include "MeshSurfaceCell.hh" #include "GeometricModel.hh" @@ -69,10 +68,10 @@ createMeshFromFile(const std::string& mesh_name, if (mesh != Teuchos::null) { // potentially build columns if (mesh_plist.isParameter("build columns from set")) { - std::string regionname = mesh_plist.get("build columns from set"); - mesh->build_columns(regionname); + std::vector regionname = {mesh_plist.get("build columns from set")}; + mesh->buildColumns(regionname); } else if (mesh_plist.get("build columns", true)) { - mesh->build_columns(); + mesh->buildColumns(); } // verify @@ -119,10 +118,10 @@ createMeshGenerated(const std::string& mesh_name, if (mesh != Teuchos::null) { // build columns if (mesh_plist.isParameter("build columns from set")) { - std::string regionname = mesh_plist.get("build columns from set"); - mesh->build_columns(regionname); + std::vector regionname = {mesh_plist.get("build columns from set")}; + mesh->buildColumns(regionname); } else if (mesh_plist.get("build columns", false)) { - mesh->build_columns(); + mesh->buildColumns(); } // verify @@ -161,9 +160,16 @@ createMeshLogical(const std::string& mesh_name, if (mesh_logical_plist.isParameter("read from file")) { auto filename = mesh_logical_plist.get("read from file"); auto my_list_in_other_file = Teuchos::getParametersFromXmlFile(filename); - mesh = fac.Create(*my_list_in_other_file); + auto meshLogical = fac.Create(*my_list_in_other_file); + mesh = Teuchos::rcp(new AmanziMesh::Mesh(meshLogical, + Teuchos::rcp(new Amanzi::AmanziMesh::MeshLogicalAlgorithms()), + Teuchos::null)); } else { - mesh = fac.Create(mesh_logical_plist); + auto meshLogical = fac.Create(mesh_logical_plist); + mesh = Teuchos::rcp(new AmanziMesh::Mesh(meshLogical, + Teuchos::rcp(new Amanzi::AmanziMesh::MeshLogicalAlgorithms()), + Teuchos::null)); + } if (mesh != Teuchos::null) { checkVerifyMesh(mesh_plist, mesh); } @@ -261,7 +267,7 @@ createMeshSurface(const std::string& mesh_name, if (S.HasMesh(parent_name)) { auto parent = S.GetMesh(parent_name); - auto comm = parent->get_comm(); + auto comm = parent->getComm(); // get the regions std::vector regions; @@ -285,11 +291,12 @@ createMeshSurface(const std::string& mesh_name, Teuchos::RCP surface3D_mesh = Teuchos::null; // construct a 3D submanifold mesh if needed and the flattened surface mesh - if (parent->manifold_dimension() == 3) { - surface3D_mesh = factory.create(parent, regions, AmanziMesh::FACE, false, true, false); - mesh = factory.create(parent, regions, AmanziMesh::FACE, true, true, false); + if (parent->getManifoldDimension() == 3) { + surface3D_mesh = factory.create(parent, regions, AmanziMesh::Entity_kind::FACE, false); + + mesh = factory.create(parent, regions, AmanziMesh::Entity_kind::FACE, true); } else { - mesh = factory.create(parent, regions, AmanziMesh::CELL, true, true, false); + mesh = factory.create(parent, regions, AmanziMesh::Entity_kind::CELL, true); } bool deformable = mesh_plist.get("deformable mesh", false); @@ -357,7 +364,7 @@ createMeshExtracted(const std::string& mesh_name, if (S.HasMesh(parent_name)) { auto parent = S.GetMesh(parent_name); - auto comm = parent->get_comm(); + auto comm = parent->getComm(); // get the regions std::vector regions; @@ -375,7 +382,7 @@ createMeshExtracted(const std::string& mesh_name, AmanziMesh::MeshFactory factory(comm, gm, mesh_factory_plist); // construct the extracted mesh - mesh = factory.create(parent, regions, AmanziMesh::CELL, false, true, false); + mesh = factory.create(parent, regions, AmanziMesh::Entity_kind::CELL, false); bool deformable = mesh_plist.get("deformable mesh", false); // register with state @@ -411,17 +418,17 @@ createMeshColumn(const std::string& mesh_name, << std::endl; } auto parent = S.GetMesh(parent_name); - auto parent_list = Teuchos::rcp(new Teuchos::ParameterList(*parent->parameter_list())); + auto parent_list = Teuchos::rcp(new Teuchos::ParameterList(*parent->getParameterList())); auto mesh = AmanziMesh::createColumnMesh(parent, lid, parent_list); bool deformable = mesh_plist.get("deformable mesh", false); // build columns and verify if (mesh != Teuchos::null) { if (mesh_plist.isParameter("build columns from set")) { - std::string regionname = mesh_plist.get("build columns from set"); - mesh->build_columns(regionname); + std::vector regionname = {mesh_plist.get("build columns from set")}; + mesh->buildColumns(regionname); } else if (mesh_plist.get("build columns", false)) { - mesh->build_columns(); + mesh->buildColumns(); } checkVerifyMesh(mesh_plist, mesh); } @@ -461,7 +468,8 @@ createMeshColumnSurface(const std::string& mesh_name, if (vo.os_OK(Teuchos::VERB_HIGH)) *vo.os() << " Constructing MeshSurfaceCell of name " << mesh_name << " with parent " << parent_name << std::endl; - auto mesh = Teuchos::rcp(new AmanziMesh::MeshSurfaceCell(parent, surface_region)); + auto meshSC = Teuchos::rcp(new AmanziMesh::MeshSurfaceCell(parent->getMeshFramework())); + auto mesh = Teuchos::rcp(new AmanziMesh::Mesh(meshSC, Teuchos::rcp(new Amanzi::AmanziMesh::MeshFrameworkAlgorithms()), Teuchos::null)); bool deformable = mesh_plist.get("deformable mesh", false); checkVerifyMesh(mesh_plist, mesh); @@ -470,6 +478,7 @@ createMeshColumnSurface(const std::string& mesh_name, *vo.os() << " Registered mesh \"" << mesh_name << "\"." << std::endl; } return mesh; + } @@ -527,7 +536,7 @@ createDomainSetIndexed(const std::string& mesh_name_pristine, // get the indexing info auto regions = ds_list.get>("regions").toVector(); - auto entity_kind = AmanziMesh::entity_kind(ds_list.get("entity kind")); + auto entity_kind = AmanziMesh::createEntityKind(ds_list.get("entity kind")); std::string indexing_parent_name = ds_list.get("indexing parent domain", "domain"); if (S.HasMesh(indexing_parent_name)) { @@ -554,10 +563,9 @@ createDomainSetIndexed(const std::string& mesh_name_pristine, // create the subdomains, indexed over entities for (const auto& region : regions) { - AmanziMesh::Entity_ID_List region_ents; - indexing_parent_mesh->get_set_entities( - region, entity_kind, AmanziMesh::Parallel_type::OWNED, ®ion_ents); - const auto& map = indexing_parent_mesh->map(entity_kind, false); + auto region_ents = indexing_parent_mesh->getSetEntities( + region, entity_kind, AmanziMesh::Parallel_kind::OWNED); + const auto& map = indexing_parent_mesh->getMap(entity_kind, false); for (const AmanziMesh::Entity_ID& lid : region_ents) { // subdomain name @@ -583,13 +591,13 @@ createDomainSetIndexed(const std::string& mesh_name_pristine, if (!subdomain_param_list.isParameter("entity LID")) subdomain_param_list.set("entity LID", lid); if (!subdomain_param_list.isParameter("entity kind")) - subdomain_param_list.set("entity kind", AmanziMesh::entity_kind_string(entity_kind)); + subdomain_param_list.set("entity kind", AmanziMesh::to_string(entity_kind)); if (!subdomain_param_list.isParameter("parent domain")) subdomain_param_list.set("parent domain", indexing_parent_name); // construct auto subdomain_mesh = - createMesh(subdomain_list, indexing_parent_mesh->get_comm(), gm, S, vo); + createMesh(subdomain_list, indexing_parent_mesh->getComm(), gm, S, vo); // create maps to the reference mesh if (is_reference_mesh) { @@ -625,8 +633,8 @@ createDomainSetIndexed(const std::string& mesh_name_pristine, mesh_name, indexing_parent_mesh, subdomains, reference_mesh, reference_maps)); } else { auto ref_domain_set = S.GetDomainSet(alias_target); - AMANZI_ASSERT(ref_domain_set->get_referencing_parent() == reference_mesh); - auto reference_maps = ref_domain_set->get_subdomain_maps(); + AMANZI_ASSERT(ref_domain_set->getReferencingParent() == reference_mesh); + auto reference_maps = ref_domain_set->getSubdomainMaps(); // these maps are all indexed by the target name, update to the aliased name. std::map>> new_reference_maps; @@ -710,7 +718,7 @@ createDomainSetRegions(const std::string& mesh_name_pristine, subdomain_param_list.set("region", subdomain); // construct - auto subdomain_mesh = createMesh(subdomain_list, indexing_parent_mesh->get_comm(), gm, S, vo); + auto subdomain_mesh = createMesh(subdomain_list, indexing_parent_mesh->getComm(), gm, S, vo); if (subdomain_mesh != Teuchos::null) { subdomains.push_back(subdomain); @@ -794,12 +802,12 @@ checkVerifyMesh(Teuchos::ParameterList& mesh_plist, Teuchos::RCP("verify mesh", false); if (verify) { - int num_procs = mesh->get_comm()->NumProc(); - int rank = mesh->get_comm()->MyPID(); + int num_procs = mesh->getComm()->NumProc(); + int rank = mesh->getComm()->MyPID(); if (rank == 0) std::cout << "Verifying mesh with Mesh Audit..." << std::endl; if (num_procs == 1) { - MeshAudit mesh_auditor(mesh); + AmanziMesh::MeshAudit mesh_auditor(mesh); int status = mesh_auditor.Verify(); if (status == 0) { std::cout << "Mesh Audit confirms that mesh is ok" << std::endl; @@ -816,13 +824,13 @@ checkVerifyMesh(Teuchos::ParameterList& mesh_plist, Teuchos::RCPget_comm()->SumAll(&ierr, &aerr, 1); + mesh->getComm()->SumAll(&ierr, &aerr, 1); if (aerr == 0) { - if (mesh->get_comm()->MyPID() == 0) + if (mesh->getComm()->MyPID() == 0) std::cout << "Mesh Audit confirms that mesh is ok" << std::endl; } else { Errors::Message msg("Mesh Audit could not verify correctness of mesh."); @@ -872,10 +880,10 @@ createMeshes(Teuchos::ParameterList& global_list, // if (global_list.isSublist("visualization columns")) { // auto surface_mesh = S.GetMesh("surface"); // Teuchos::ParameterList& vis_ss_plist = global_list.sublist("visualization columns"); - // int nc = surface_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + // int nc = surface_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // for (int c=0; c!=nc; ++c){ - // int id = surface_mesh->cell_map(false).GID(c); + // int id = surface_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c); // std::stringstream name_ss; // name_ss << "column_" << id; // vis_ss_plist.set("file name base", "visdump_"+name_ss.str()); @@ -888,9 +896,9 @@ createMeshes(Teuchos::ParameterList& global_list, // if (global_list.isSublist("visualization surface cells")) { // auto surface_mesh = S.GetMesh("surface"); // Teuchos::ParameterList& vis_sf_plist = global_list.sublist("visualization surface cells"); - // int nc = surface_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + // int nc = surface_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // for (int c=0; c!=nc; ++c){ - // int id = surface_mesh->cell_map(false).GID(c); + // int id = surface_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c); // std::stringstream name_ss, name_sf; // name_sf << "surface_column_" << id; // vis_sf_plist.set("file name base", "visdump_"+name_sf.str()); diff --git a/src/executables/coordinator.cc b/src/executables/coordinator.cc index 811fcd8e8..ab85dbd16 100644 --- a/src/executables/coordinator.cc +++ b/src/executables/coordinator.cc @@ -118,7 +118,7 @@ Coordinator::Coordinator(const Teuchos::RCP& plist, node_key, Amanzi::Tags::NEXT, node_key) .SetMesh(mesh->second.first) ->SetGhosted() - ->SetComponent("node", Amanzi::AmanziMesh::NODE, mesh->second.first->space_dimension()); + ->SetComponent("node", Amanzi::AmanziMesh::Entity_kind::NODE, mesh->second.first->getSpaceDimension()); } // writes region information @@ -281,7 +281,7 @@ Coordinator::initialize() auto vis = Teuchos::rcp(new Amanzi::VisualizationDomainSet(*sublist_p)); vis->set_name(domain_name_base); vis->set_domain_set(dset); - vis->set_mesh(dset->get_referencing_parent()); + vis->set_mesh(dset->getReferencingParent()); vis->CreateFiles(false); visualization_.push_back(vis); } @@ -355,7 +355,7 @@ Coordinator::report_memory() double global_ncells(0.0); double local_ncells(0.0); for (Amanzi::State::mesh_iterator mesh = S_->mesh_begin(); mesh != S_->mesh_end(); ++mesh) { - Epetra_Map cell_map = (mesh->second.first)->cell_map(false); + Epetra_Map cell_map = (mesh->second.first)->getMap(Amanzi::AmanziMesh::Entity_kind::CELL,false); global_ncells += cell_map.NumGlobalElements(); local_ncells += cell_map.NumMyElements(); } @@ -521,11 +521,11 @@ Coordinator::advance() vc_vec->ScatterMasterToGhosted(); const Epetra_MultiVector& vc = *vc_vec->ViewComponent("node", true); - std::vector node_ids(vc.MyLength()); - Amanzi::AmanziGeometry::Point_List old_positions(vc.MyLength()); + Amanzi::AmanziMesh::Entity_ID_View node_ids("node_ids", vc.MyLength()); + Amanzi::AmanziMesh::Point_View old_positions("old_positions", vc.MyLength()); for (int n = 0; n != vc.MyLength(); ++n) { node_ids[n] = n; - if (mesh->second.first->space_dimension() == 2) { + if (mesh->second.first->getSpaceDimension() == 2) { old_positions[n] = Amanzi::AmanziGeometry::Point(vc[0][n], vc[1][n]); } else { old_positions[n] = Amanzi::AmanziGeometry::Point(vc[0][n], vc[1][n], vc[2][n]); @@ -533,8 +533,7 @@ Coordinator::advance() } // undeform the mesh - Amanzi::AmanziGeometry::Point_List final_positions; - mesh->second.first->deform(node_ids, old_positions, false, &final_positions); + Amanzi::AmanziMesh::MeshAlgorithms::deform(*(mesh->second.first), node_ids, old_positions); } } } diff --git a/src/executables/test/Main.cc b/src/executables/test/Main.cc index 614dad35a..f7be07192 100644 --- a/src/executables/test/Main.cc +++ b/src/executables/test/Main.cc @@ -16,9 +16,14 @@ #include "ats_registration_files.hh" #include "VerboseObject_objs.hh" +#include "Kokkos_Core.hpp" + int main(int argc, char* argv[]) { + Kokkos::initialize(argc, argv); Teuchos::GlobalMPISession mpiSession(&argc, &argv); - return UnitTest::RunAllTests(); + auto result = UnitTest::RunAllTests(); + Kokkos::finalize(); + return result; } diff --git a/src/executables/test/executable_mesh_factory.cc b/src/executables/test/executable_mesh_factory.cc index c087ba864..2e4b908f0 100644 --- a/src/executables/test/executable_mesh_factory.cc +++ b/src/executables/test/executable_mesh_factory.cc @@ -54,14 +54,14 @@ SUITE(ATS_MESH_FACTORY) CHECK(S->HasMesh("domain")); int has_surface = 0; - int set_size = S->GetMesh("domain")->get_set_size( - "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_type::OWNED); + int set_size = S->GetMesh("domain")->getSetSize( + "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); if (set_size > 0) { has_surface += 1; CHECK(S->HasMesh("surface")); CHECK_EQUAL(set_size, - S->GetMesh("surface")->num_entities(AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED)); + S->GetMesh("surface")->getNumEntities(AmanziMesh::Entity_kind::CELL, + AmanziMesh::Parallel_kind::OWNED)); } int total_has_surface = 0; @@ -78,15 +78,15 @@ SUITE(ATS_MESH_FACTORY) CHECK(S->HasMesh("domain")); int has_upstream = 0; - int set_size = S->GetMesh("domain")->get_set_size( - "upstream", AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED); + int set_size = S->GetMesh("domain")->getSetSize( + "upstream", AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (set_size > 0) { has_upstream += 1; CHECK(S->HasMesh("watershed:upstream")); CHECK_EQUAL( set_size, S->GetMesh("watershed:upstream") - ->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED)); + ->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED)); } int total_has_upstream = 0; @@ -98,7 +98,7 @@ SUITE(ATS_MESH_FACTORY) auto ds = S->GetDomainSet("watershed"); for (const auto& subdomain : *ds) { subdomain_vecs[subdomain] = - Teuchos::rcp(new Epetra_MultiVector(S->GetMesh(subdomain)->cell_map(false), 1)); + Teuchos::rcp(new Epetra_MultiVector(S->GetMesh(subdomain)->getMap(AmanziMesh::Entity_kind::CELL,false), 1)); if (subdomain == "watershed:upstream") { subdomain_vecs[subdomain]->PutScalar(1.); } else { @@ -107,10 +107,10 @@ SUITE(ATS_MESH_FACTORY) } // import to a global vector - Epetra_MultiVector vec(S->GetMesh("domain")->cell_map(false), 1); + Epetra_MultiVector vec(S->GetMesh("domain")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); vec.PutScalar(-1); - for (const auto& subdomain : *ds) { ds->DoImport(subdomain, *subdomain_vecs[subdomain], vec); } + for (const auto& subdomain : *ds) { ds->doImport(subdomain, *subdomain_vecs[subdomain], vec); } double result; vec.MinValue(&result); @@ -131,14 +131,14 @@ SUITE(ATS_MESH_FACTORY) // check we got a valid surface mesh int has_surface = 0; - int set_size = S->GetMesh("domain")->get_set_size( - "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_type::OWNED); + int set_size = S->GetMesh("domain")->getSetSize( + "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); if (set_size > 0) { has_surface += 1; CHECK(S->HasMesh("surface")); CHECK_EQUAL(set_size, - S->GetMesh("surface")->num_entities(AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED)); + S->GetMesh("surface")->getNumEntities(AmanziMesh::Entity_kind::CELL, + AmanziMesh::Parallel_kind::OWNED)); } int total_has_surface = 0; @@ -147,15 +147,15 @@ SUITE(ATS_MESH_FACTORY) // check we got upstream/downstream subdomains int has_upstream = 0; - int set_size_us = S->GetMesh("domain")->get_set_size( - "upstream", AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED); + int set_size_us = S->GetMesh("domain")->getSetSize( + "upstream", AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (set_size_us > 0) { has_upstream += 1; CHECK(S->HasMesh("watershed:upstream")); CHECK_EQUAL( set_size_us, S->GetMesh("watershed:upstream") - ->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED)); + ->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED)); } int total_has_upstream = 0; @@ -174,7 +174,7 @@ SUITE(ATS_MESH_FACTORY) auto ds = S->GetDomainSet("surface_watershed"); for (const auto& subdomain : *ds) { subdomain_vecs[subdomain] = - Teuchos::rcp(new Epetra_MultiVector(S->GetMesh(subdomain)->cell_map(false), 1)); + Teuchos::rcp(new Epetra_MultiVector(S->GetMesh(subdomain)->getMap(AmanziMesh::Entity_kind::CELL,false), 1)); if (subdomain == "surface_watershed:upstream") { subdomain_vecs[subdomain]->PutScalar(1.); } else { @@ -184,11 +184,11 @@ SUITE(ATS_MESH_FACTORY) // import to a global vector if (S->HasMesh("surface")) { - Epetra_MultiVector vec(S->GetMesh("surface")->cell_map(false), 1); + Epetra_MultiVector vec(S->GetMesh("surface")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); vec.PutScalar(-1); for (const auto& subdomain : *ds) { - ds->DoImport(subdomain, *subdomain_vecs[subdomain], vec); + ds->doImport(subdomain, *subdomain_vecs[subdomain], vec); } double result; @@ -210,51 +210,51 @@ SUITE(ATS_MESH_FACTORY) CHECK(S->HasMesh("domain")); int has_surface = 0; - int set_size = S->GetMesh("domain")->get_set_size( - "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_type::OWNED); + int set_size = S->GetMesh("domain")->getSetSize( + "surface", AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); CHECK(set_size > 0); // columnar partitioned if (set_size > 0) { has_surface += 1; CHECK(S->HasMesh("surface")); CHECK_EQUAL(set_size, - S->GetMesh("surface")->num_entities(AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED)); + S->GetMesh("surface")->getNumEntities(AmanziMesh::Entity_kind::CELL, + AmanziMesh::Parallel_kind::OWNED)); } - int num_cells = S->GetMesh("domain")->num_entities(AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED); + int num_cells = S->GetMesh("domain")->getNumEntities(AmanziMesh::Entity_kind::CELL, + AmanziMesh::Parallel_kind::OWNED); CHECK_EQUAL(0, num_cells % set_size); int ncells_per_column = num_cells / set_size; for (int col = 0; col != set_size; ++col) { // check that columns were made correctly - CHECK_EQUAL(ncells_per_column, S->GetMesh("domain")->cells_of_column(col).size()); - CHECK_EQUAL(ncells_per_column + 1, S->GetMesh("domain")->faces_of_column(col).size()); + CHECK_EQUAL(ncells_per_column, S->GetMesh("domain")->columns.getCells(col).size()); + CHECK_EQUAL(ncells_per_column + 1, S->GetMesh("domain")->columns.getFaces(col).size()); // column mesh std::string col_name = - Keys::getDomainInSet("column", S->GetMesh("surface")->cell_map(false).GID(col)); + Keys::getDomainInSet("column", S->GetMesh("surface")->getMap(AmanziMesh::Entity_kind::CELL,false).GID(col)); CHECK(S->HasMesh(col_name)); CHECK_EQUAL(ncells_per_column, - S->GetMesh(col_name)->num_entities(AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED)); + S->GetMesh(col_name)->getNumEntities(AmanziMesh::Entity_kind::CELL, + AmanziMesh::Parallel_kind::OWNED)); } { // construct col id vector - Epetra_MultiVector vec1(S->GetMesh("domain")->cell_map(false), 1); - Epetra_MultiVector vec2(S->GetMesh("domain")->cell_map(false), 1); + Epetra_MultiVector vec1(S->GetMesh("domain")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); + Epetra_MultiVector vec2(S->GetMesh("domain")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); auto ds = S->GetDomainSet("column"); int col = 0; for (const auto& subdomain : *ds) { // fill via import - Epetra_MultiVector vec_l(S->GetMesh(subdomain)->cell_map(false), 1); + Epetra_MultiVector vec_l(S->GetMesh(subdomain)->getMap(AmanziMesh::Entity_kind::CELL,false), 1); int index = Keys::getDomainSetIndex(subdomain); vec_l.PutScalar((double)index); - ds->DoImport(subdomain, vec_l, vec2); + ds->doImport(subdomain, vec_l, vec2); // fill via column - for (const auto& c : S->GetMesh("domain")->cells_of_column(col)) { vec1[0][c] = index; } + for (const auto& c : S->GetMesh("domain")->columns.getCells(col)) { vec1[0][c] = index; } col++; } @@ -269,28 +269,28 @@ SUITE(ATS_MESH_FACTORY) for (int col = 0; col != set_size; ++col) { // column mesh std::string surf_col_name = - Keys::getDomainInSet("surface_column", S->GetMesh("surface")->cell_map(false).GID(col)); + Keys::getDomainInSet("surface_column", S->GetMesh("surface")->getMap(AmanziMesh::Entity_kind::CELL,false).GID(col)); CHECK(S->HasMesh(surf_col_name)); CHECK_EQUAL( 1, S->GetMesh(surf_col_name) - ->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED)); + ->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED)); } { // construct col id vector - Epetra_MultiVector vec1(S->GetMesh("surface")->cell_map(false), 1); - Epetra_MultiVector vec2(S->GetMesh("surface")->cell_map(false), 1); + Epetra_MultiVector vec1(S->GetMesh("surface")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); + Epetra_MultiVector vec2(S->GetMesh("surface")->getMap(AmanziMesh::Entity_kind::CELL,false), 1); auto ds = S->GetDomainSet("surface_column"); int col = 0; for (const auto& subdomain : *ds) { // fill via import - Epetra_MultiVector vec_l(S->GetMesh(subdomain)->cell_map(false), 1); + Epetra_MultiVector vec_l(S->GetMesh(subdomain)->getMap(AmanziMesh::Entity_kind::CELL,false), 1); int index = Keys::getDomainSetIndex(subdomain); vec_l.PutScalar((double)index); - ds->DoImport(subdomain, vec_l, vec2); + ds->doImport(subdomain, vec_l, vec2); // fill via column vec1[0][col] = index; diff --git a/src/operators/advection/advection_donor_upwind.cc b/src/operators/advection/advection_donor_upwind.cc index 8e9a74663..f198a3986 100644 --- a/src/operators/advection/advection_donor_upwind.cc +++ b/src/operators/advection/advection_donor_upwind.cc @@ -23,8 +23,8 @@ AdvectionDonorUpwind::AdvectionDonorUpwind(Teuchos::ParameterList& advect_plist, const Teuchos::RCP mesh) : Advection(advect_plist, mesh) { - upwind_cell_ = Teuchos::rcp(new Epetra_IntVector(mesh_->face_map(true))); - downwind_cell_ = Teuchos::rcp(new Epetra_IntVector(mesh_->face_map(true))); + upwind_cell_ = Teuchos::rcp(new Epetra_IntVector(mesh_->getMap(AmanziMesh::Entity_kind::FACE,true))); + downwind_cell_ = Teuchos::rcp(new Epetra_IntVector(mesh_->getMap(AmanziMesh::Entity_kind::FACE,true))); }; @@ -91,15 +91,13 @@ AdvectionDonorUpwind::IdentifyUpwindCells_() upwind_cell_->PutValue(-1); downwind_cell_->PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; flux_->ScatterMasterToGhosted("face"); const Epetra_MultiVector& flux_f = *flux_->ViewComponent("face", true); - unsigned int ncells_used = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::ALL); + unsigned int ncells_used = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::ALL); for (unsigned int c = 0; c != ncells_used; ++c) { - mesh_->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh_->getCellFacesAndDirections(c); for (unsigned int i = 0; i != faces.size(); ++i) { AmanziMesh::Entity_ID f = faces[i]; diff --git a/src/operators/upwinding/upwind_arithmetic_mean.cc b/src/operators/upwinding/upwind_arithmetic_mean.cc index 6bdecbe83..cb25a2eeb 100644 --- a/src/operators/upwinding/upwind_arithmetic_mean.cc +++ b/src/operators/upwinding/upwind_arithmetic_mean.cc @@ -53,13 +53,12 @@ UpwindArithmeticMean::CalculateCoefficientsOnFaces(const CompositeVector& cell_c const std::string face_component) const { Teuchos::RCP mesh = face_coef.Mesh(); - AmanziMesh::Entity_ID_List faces; // initialize the face coefficients face_coef.ViewComponent(face_component, true)->PutScalar(0.0); if (face_coef.HasComponent("cell")) { face_coef.ViewComponent("cell", true)->PutScalar(1.0); } - // Note that by scattering, and then looping over all Parallel_type::ALL cells, we + // Note that by scattering, and then looping over all Parallel_kind::ALL cells, we // end up getting the correct upwind values in all faces (owned or // not) bordering an owned cell. This is the necessary data for // making the local matrices in MFD, so there is no need to @@ -73,7 +72,7 @@ UpwindArithmeticMean::CalculateCoefficientsOnFaces(const CompositeVector& cell_c int c_used = cell_coef.size(cell_component, true); for (int c = 0; c != c_used; ++c) { - mesh->cell_get_faces(c, &faces); + auto faces = mesh->getCellFaces(c); for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -82,10 +81,9 @@ UpwindArithmeticMean::CalculateCoefficientsOnFaces(const CompositeVector& cell_c } // rescale boundary faces, as these had only one cell neighbor - unsigned int f_owned = mesh->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + unsigned int f_owned = mesh->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (unsigned int f = 0; f != f_owned; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); if (cells.size() == 1) { face_coef_f[0][f] *= 2.; } } }; @@ -113,7 +111,7 @@ UpwindArithmeticMean::UpdateDerivatives( // Grab mesh and allocate space Teuchos::RCP mesh = pres.Mesh(); unsigned int nfaces_owned = - mesh->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + mesh->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); Jpp_faces->resize(nfaces_owned); // workspace @@ -122,8 +120,7 @@ UpwindArithmeticMean::UpdateDerivatives( for (unsigned int f = 0; f != nfaces_owned; ++f) { // get neighboring cells - AmanziMesh::Entity_ID_List cells; - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int mcells = cells.size(); // create the local matrix @@ -137,7 +134,7 @@ UpwindArithmeticMean::UpdateDerivatives( p[1] = bc_values[f]; double dp = p[0] - p[1]; - (*Jpp)(0, 0) = dp * mesh->face_area(f) * dcell_v[0][cells[0]]; + (*Jpp)(0, 0) = dp * mesh->getFaceArea(f) * dcell_v[0][cells[0]]; } else { (*Jpp)(0, 0) = 0.; } @@ -148,8 +145,8 @@ UpwindArithmeticMean::UpdateDerivatives( dK_dp[0] = 0.5 * dcell_v[0][cells[0]]; dK_dp[1] = 0.5 * dcell_v[0][cells[1]]; - (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[0]; - (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[1]; + (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[0]; + (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[1]; (*Jpp)(1, 0) = -(*Jpp)(0, 0); (*Jpp)(1, 1) = -(*Jpp)(0, 1); } diff --git a/src/operators/upwinding/upwind_elevation_stabilized.cc b/src/operators/upwinding/upwind_elevation_stabilized.cc index 5cd60a835..6155f644b 100644 --- a/src/operators/upwinding/upwind_elevation_stabilized.cc +++ b/src/operators/upwinding/upwind_elevation_stabilized.cc @@ -97,8 +97,8 @@ UpwindElevationStabilized::CalculateCoefficientsOnFaces(const CompositeVector& s double slope_regularization = slope_regularization_; double manning_exp = manning_exp_; - const auto& face_map = mesh->face_map(false); - const auto& bface_map = mesh->exterior_face_map(false); + const auto& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); + const auto& bface_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); // Determine the face coefficient of local faces. // @@ -109,8 +109,7 @@ UpwindElevationStabilized::CalculateCoefficientsOnFaces(const CompositeVector& s // always true for FV, maybe not for MFD. int nfaces = face_coef.size("face", false); for (int f = 0; f != nfaces; ++f) { - AmanziMesh::Entity_ID_List fcells; - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + auto fcells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() > 0); double denom[2] = { 0., 0. }; @@ -119,7 +118,7 @@ UpwindElevationStabilized::CalculateCoefficientsOnFaces(const CompositeVector& s double elev[2] = { 0., 0. }; double dens[2] = { 0., 0. }; - weight[0] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(fcells[0])); + weight[0] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(fcells[0])); denom[0] = manning_coef_v[0][fcells[0]] * std::sqrt(std::max(slope_v[0][fcells[0]], slope_regularization)); pres_elev[0] = pd_v[0][fcells[0]] + elev_v[0][fcells[0]]; @@ -127,7 +126,7 @@ UpwindElevationStabilized::CalculateCoefficientsOnFaces(const CompositeVector& s dens[0] = dens_v[0][fcells[0]]; if (fcells.size() > 1) { - weight[1] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(fcells[1])); + weight[1] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(fcells[1])); denom[1] = manning_coef_v[0][fcells[1]] * std::sqrt(std::max(slope_v[0][fcells[1]], slope_regularization)); pres_elev[1] = pd_v[0][fcells[1]] + elev_v[0][fcells[1]]; diff --git a/src/operators/upwinding/upwind_flux_fo_cont.cc b/src/operators/upwinding/upwind_flux_fo_cont.cc index 55dbf7cf3..2099bac56 100644 --- a/src/operators/upwinding/upwind_flux_fo_cont.cc +++ b/src/operators/upwinding/upwind_flux_fo_cont.cc @@ -93,13 +93,11 @@ UpwindFluxFOCont::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef, Epetra_IntVector downwind_cell(*face_coef.ComponentMap("face", true)); downwind_cell.PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; int nfaces_local = flux.size("face", false); int ncells = cell_coef.size("cell", true); for (int c = 0; c != ncells; ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh->getCellFacesAndDirections(c); for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -158,8 +156,8 @@ UpwindFluxFOCont::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef, denom[0] = manning_coef_v[0][uw] * std::sqrt(std::max(slope_v[0][uw], slope_regularization)); denom[1] = manning_coef_v[0][dw] * std::sqrt(std::max(slope_v[0][dw], slope_regularization)); double dist[2]; - dist[0] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(uw)); - dist[1] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(dw)); + dist[0] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(uw)); + dist[1] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(dw)); denominator = (dist[0] + dist[1]) / (dist[0] / denom[0] + dist[1] / denom[1]); } diff --git a/src/operators/upwinding/upwind_flux_harmonic_mean.cc b/src/operators/upwinding/upwind_flux_harmonic_mean.cc index 66ef21986..e8b82bab4 100644 --- a/src/operators/upwinding/upwind_flux_harmonic_mean.cc +++ b/src/operators/upwinding/upwind_flux_harmonic_mean.cc @@ -70,14 +70,12 @@ UpwindFluxHarmonicMean::CalculateCoefficientsOnFaces(const CompositeVector& cell Epetra_IntVector downwind_cell(*face_coef.ComponentMap("face", true)); downwind_cell.PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; int nfaces_local = flux.size("face", false); int ncells = cell_coef.size("cell", true); for (int c = 0; c != ncells; ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &fdirs); - + const auto& [faces, fdirs] = mesh->getCellFacesAndDirections(c); + for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -140,8 +138,8 @@ UpwindFluxHarmonicMean::CalculateCoefficientsOnFaces(const CompositeVector& cell coef_faces[0][f] = coefs[0]; else { double dist[2]; - dist[0] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(uw)); - dist[1] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(dw)); + dist[0] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(uw)); + dist[1] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(dw)); double hmean = 0.0; if ((coefs[0] != 0.0) && (coefs[1] != 0.0)) diff --git a/src/operators/upwinding/upwind_flux_split_denominator.cc b/src/operators/upwinding/upwind_flux_split_denominator.cc index dbae153df..00d5fa767 100644 --- a/src/operators/upwinding/upwind_flux_split_denominator.cc +++ b/src/operators/upwinding/upwind_flux_split_denominator.cc @@ -89,13 +89,11 @@ UpwindFluxSplitDenominator::CalculateCoefficientsOnFaces(const CompositeVector& Epetra_IntVector downwind_cell(*face_coef.ComponentMap("face", true)); downwind_cell.PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; int nfaces_local = flux.size("face", false); int ncells = cell_coef.size("cell", true); for (int c = 0; c != ncells; ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh->getCellFacesAndDirections(c); for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -144,7 +142,7 @@ UpwindFluxSplitDenominator::CalculateCoefficientsOnFaces(const CompositeVector& coefs[1] = coef_cells[0][dw] * denominator; // weighted by path length - weight[1] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(dw)); + weight[1] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(dw)); weight[0] = weight[1]; } else if (dw == -1) { @@ -156,7 +154,7 @@ UpwindFluxSplitDenominator::CalculateCoefficientsOnFaces(const CompositeVector& coefs[1] = coef_cells[0][uw] * denominator; // downwind boundary face not defined always //coefs[1] = coef_faces[0][f] * denominator; - weight[0] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(uw)); + weight[0] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(uw)); weight[1] = weight[0]; } else { @@ -169,8 +167,8 @@ UpwindFluxSplitDenominator::CalculateCoefficientsOnFaces(const CompositeVector& coefs[1] = coef_cells[0][dw] * denom[1]; // harmonic mean of the denominator - weight[0] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(uw)); - weight[1] = AmanziGeometry::norm(mesh->face_centroid(f) - mesh->cell_centroid(dw)); + weight[0] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(uw)); + weight[1] = AmanziGeometry::norm(mesh->getFaceCentroid(f) - mesh->getCellCentroid(dw)); AMANZI_ASSERT(denom[0] > 0); AMANZI_ASSERT(denom[1] > 0); AMANZI_ASSERT(weight[0] > 0); diff --git a/src/operators/upwinding/upwind_gravity_flux.cc b/src/operators/upwinding/upwind_gravity_flux.cc index 85ec5ef83..39e2a075f 100644 --- a/src/operators/upwinding/upwind_gravity_flux.cc +++ b/src/operators/upwinding/upwind_gravity_flux.cc @@ -57,8 +57,6 @@ UpwindGravityFlux::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef CompositeVector& face_coef, const std::string face_component) const { - AmanziMesh::Entity_ID_List faces; - std::vector dirs; double flow_eps = 1.e-10; Teuchos::RCP mesh = face_coef.Mesh(); @@ -67,7 +65,7 @@ UpwindGravityFlux::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef face_coef.ViewComponent(face_component, true)->PutScalar(0.0); if (face_coef.HasComponent("cell")) { face_coef.ViewComponent("cell", true)->PutScalar(1.0); } - // Note that by scattering, and then looping over all Parallel_type::ALL cells, we + // Note that by scattering, and then looping over all Parallel_kind::ALL cells, we // end up getting the correct upwind values in all faces (owned or // not) bordering an owned cell. This is the necessary data for // making the local matrices in MFD, so there is no need to @@ -81,13 +79,13 @@ UpwindGravityFlux::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef for (unsigned int c = 0; c != cell_coef.size(cell_component, true); ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh->getCellFacesAndDirections(c); AmanziGeometry::Point Kgravity = (*K_)[c] * gravity; for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; - const AmanziGeometry::Point& normal = mesh->face_normal(f); + const AmanziGeometry::Point& normal = mesh->getFaceNormal(f); if ((normal * Kgravity) * dirs[n] >= flow_eps) { face_coef_v[0][f] = cell_coef_v[0][c]; } else if (std::abs((normal * Kgravity) * dirs[n]) < flow_eps) { diff --git a/src/operators/upwinding/upwind_potential_difference.cc b/src/operators/upwinding/upwind_potential_difference.cc index b292330a0..8754d4f50 100644 --- a/src/operators/upwinding/upwind_potential_difference.cc +++ b/src/operators/upwinding/upwind_potential_difference.cc @@ -57,7 +57,6 @@ UpwindPotentialDifference::CalculateCoefficientsOnFaces(const CompositeVector& c if (face_coef.HasComponent("cell")) { face_coef.ViewComponent("cell", true)->PutScalar(1.0); } Teuchos::RCP mesh = face_coef.Mesh(); - AmanziMesh::Entity_ID_List cells; std::vector dirs; double eps = 1.e-16; @@ -75,7 +74,7 @@ UpwindPotentialDifference::CalculateCoefficientsOnFaces(const CompositeVector& c int nfaces = face_coef.size("face", false); for (unsigned int f = 0; f != nfaces; ++f) { - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); if (cells.size() == 1) { if (potential_f != Teuchos::null) { @@ -149,7 +148,7 @@ UpwindPotentialDifference::UpdateDerivatives( // Grab mesh and allocate space Teuchos::RCP mesh = dconductivity.Mesh(); unsigned int nfaces_owned = - mesh->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + mesh->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); Jpp_faces->resize(nfaces_owned); // workspace @@ -157,8 +156,7 @@ UpwindPotentialDifference::UpdateDerivatives( double p[2]; for (unsigned int f = 0; f != nfaces_owned; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int mcells = cells.size(); // create the local matrix @@ -174,7 +172,7 @@ UpwindPotentialDifference::UpdateDerivatives( double dp = p[0] - p[1]; if (p[0] > p[1]) { - (*Jpp)(0, 0) = dp * mesh->face_area(f) * dK_dp[0]; + (*Jpp)(0, 0) = dp * mesh->getFaceArea(f) * dK_dp[0]; } else { (*Jpp)(0, 0) = 0.; } @@ -219,8 +217,8 @@ UpwindPotentialDifference::UpdateDerivatives( dK_dp[1] = param * dcell_v[0][cells[1]]; } - (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[0]; - (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[1]; + (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[0]; + (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[1]; (*Jpp)(1, 0) = -(*Jpp)(0, 0); (*Jpp)(1, 1) = -(*Jpp)(0, 1); } diff --git a/src/operators/upwinding/upwind_total_flux.cc b/src/operators/upwinding/upwind_total_flux.cc index e1f43ce36..de82bb532 100644 --- a/src/operators/upwinding/upwind_total_flux.cc +++ b/src/operators/upwinding/upwind_total_flux.cc @@ -83,8 +83,6 @@ UpwindTotalFlux::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef, Epetra_IntVector downwind_cell(*face_coef.ComponentMap(face_component, true)); downwind_cell.PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; int nfaces_local = flux.size("face", false); bool has_cells = face_coef.HasComponent("cell"); @@ -93,7 +91,7 @@ UpwindTotalFlux::CalculateCoefficientsOnFaces(const CompositeVector& cell_coef, int ncells = cell_coef.size(cell_component, true); for (int c = 0; c != ncells; ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh->getCellFacesAndDirections(c); for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -203,7 +201,7 @@ UpwindTotalFlux::UpdateDerivatives( // Grab mesh and allocate space Teuchos::RCP mesh = dconductivity.Mesh(); unsigned int nfaces_owned = - mesh->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + mesh->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); Jpp_faces->resize(nfaces_owned); // workspace @@ -213,17 +211,14 @@ UpwindTotalFlux::UpdateDerivatives( // Identify upwind/downwind cells for each local face. Note upwind/downwind // may be a ghost cell. - Epetra_IntVector upwind_cell(mesh->face_map(true)); + Epetra_IntVector upwind_cell(mesh->getMap(AmanziMesh::Entity_kind::FACE,true)); upwind_cell.PutValue(-1); - Epetra_IntVector downwind_cell(mesh->face_map(true)); + Epetra_IntVector downwind_cell(mesh->getMap(AmanziMesh::Entity_kind::FACE,true)); downwind_cell.PutValue(-1); - AmanziMesh::Entity_ID_List faces; - std::vector fdirs; - int ncells = dcell_v.MyLength(); for (int c = 0; c != ncells; ++c) { - mesh->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh->getCellFacesAndDirections(c); for (unsigned int n = 0; n != faces.size(); ++n) { int f = faces[n]; @@ -252,8 +247,7 @@ UpwindTotalFlux::UpdateDerivatives( int dw = downwind_cell[f]; AMANZI_ASSERT(!((uw == -1) && (dw == -1))); - AmanziMesh::Entity_ID_List cells; - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int mcells = cells.size(); // uw coef @@ -313,7 +307,7 @@ UpwindTotalFlux::UpdateDerivatives( p[1] = bc_values[f]; double dp = p[0] - p[1]; - (*Jpp)(0, 0) = dp * mesh->face_area(f) * dK_dp[0]; + (*Jpp)(0, 0) = dp * mesh->getFaceArea(f) * dK_dp[0]; } else { (*Jpp)(0, 0) = 0.; } @@ -322,8 +316,8 @@ UpwindTotalFlux::UpdateDerivatives( p[0] = pres_v[0][cells[0]]; p[1] = pres_v[0][cells[1]]; - (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[0]; - (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->face_area(f) * dK_dp[1]; + (*Jpp)(0, 0) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[0]; + (*Jpp)(0, 1) = (p[0] - p[1]) * mesh->getFaceArea(f) * dK_dp[1]; (*Jpp)(1, 0) = -(*Jpp)(0, 0); (*Jpp)(1, 1) = -(*Jpp)(0, 1); } diff --git a/src/pks/biogeochemistry/bgc_simple/bgc_simple.cc b/src/pks/biogeochemistry/bgc_simple/bgc_simple.cc index e147d65cd..48bdaf65a 100644 --- a/src/pks/biogeochemistry/bgc_simple/bgc_simple.cc +++ b/src/pks/biogeochemistry/bgc_simple/bgc_simple.cc @@ -96,20 +96,20 @@ BGCSimple::Setup() // set sizes num_pfts_ = pft_names.size(); - num_cols_ = mesh_surf_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + num_cols_ = mesh_surf_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); pfts_old_.resize(num_cols_); pfts_.resize(num_cols_); for (unsigned int col = 0; col != num_cols_; ++col) { - int f = mesh_surf_->entity_get_parent(AmanziMesh::CELL, col); - auto& col_iter = mesh_->cells_of_column(col); + int f = mesh_surf_->getEntityParent(AmanziMesh::Entity_kind::CELL, col); + auto col_iter = mesh_->columns.getCells(col); std::size_t ncol_cells = col_iter.size(); // unclear which this should be: // -- col area is the true face area - double col_area = mesh_->face_area(f); + double col_area = mesh_->getFaceArea(f); // -- col area is the projected face area - // double col_area = mesh_surf_->cell_volume(col); + // double col_area = mesh_surf_->getCellVolume(col); if (ncells_per_col_ < 0) { ncells_per_col_ = ncol_cells; @@ -134,7 +134,7 @@ BGCSimple::Setup() for (unsigned int col = 0; col != num_cols_; ++col) { soil_carbon_pools_[col].resize(ncells_per_col_); - auto& col_iter = mesh_->cells_of_column(col); + auto col_iter = mesh_->columns.getCells(col); ncells_per_col_ = col_iter.size(); for (std::size_t i = 0; i != col_iter.size(); ++i) { @@ -146,74 +146,74 @@ BGCSimple::Setup() // requirements: primary variable S_->Require(key_, tag_next_, name_) .SetMesh(mesh_) - ->SetComponent("cell", AmanziMesh::CELL, num_pools_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pools_); // requirements: other primary variables S_->Require(trans_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireEvaluatorPrimary(trans_key_, tag_next_, *S_); S_->Require(shaded_sw_key_, tag_next_, name_) .SetMesh(mesh_surf_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireEvaluatorPrimary(shaded_sw_key_, tag_next_, *S_); S_->Require(total_lai_key_, tag_next_, name_) .SetMesh(mesh_surf_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireEvaluatorPrimary(total_lai_key_, tag_next_, *S_); // requirement: diagnostics S_->Require("co2_decomposition", tag_next_, name_) .SetMesh(mesh_) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->Require("surface-total_biomass", tag_next_, name_) .SetMesh(mesh_surf_) - ->SetComponent("cell", AmanziMesh::CELL, num_pfts_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pfts_); S_->GetRecordSetW("surface-total_biomass").set_subfieldnames(pft_names); S_->Require("surface-leaf_biomass", tag_next_, name_) .SetMesh(mesh_surf_) - ->SetComponent("cell", AmanziMesh::CELL, num_pfts_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pfts_); S_->GetRecordSetW("surface-leaf_biomass").set_subfieldnames(pft_names); S_->Require("surface-leaf_area_index", tag_next_, name_) .SetMesh(mesh_surf_) - ->SetComponent("cell", AmanziMesh::CELL, num_pfts_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pfts_); S_->GetRecordSetW("surface-leaf_area_index").set_subfieldnames(pft_names); S_->Require("surface-c_sink_limit", tag_next_, name_) .SetMesh(mesh_surf_) - ->SetComponent("cell", AmanziMesh::CELL, num_pfts_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pfts_); S_->GetRecordSetW("surface-c_sink_limit").set_subfieldnames(pft_names); S_->Require( "surface-veg_total_transpiration", tag_next_, name_) .SetMesh(mesh_surf_) - ->SetComponent("cell", AmanziMesh::CELL, num_pfts_); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_pfts_); S_->GetRecordSetW("surface-veg_total_transpiration").set_subfieldnames(pft_names); // requirement: temp of each cell S_->RequireEvaluator("temperature", tag_next_); S_->Require("temperature", tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // requirement: pressure S_->RequireEvaluator("pressure", tag_next_); S_->Require("pressure", tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // requirements: surface cell volume S_->Require("surface-cell_volume", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface-cell_volume", tag_next_); // requirements: Met data @@ -221,27 +221,27 @@ BGCSimple::Setup() S_->Require("surface-incoming_shortwave_radiation", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface-air_temperature", tag_next_); S_->Require("surface-air_temperature", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface-vapor_pressure_air", tag_next_); S_->Require("surface-vapor_pressure_air", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface-wind_speed", tag_next_); S_->Require("surface-wind_speed", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface-co2_concentration", tag_next_); S_->Require("surface-co2_concentration", tag_next_) .SetMesh(mesh_surf_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } // -- Initialize owned (dependent) variables. @@ -284,7 +284,7 @@ BGCSimple::Initialize() ->ViewComponent("cell", false); int num_cols_ = - mesh_surf_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + mesh_surf_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int col = 0; col != num_cols_; ++col) { for (int i = 0; i != bio.NumVectors(); ++i) { pfts_old_[col][i]->Bleaf = bio[i][col]; } } @@ -306,7 +306,7 @@ BGCSimple::Initialize() const Epetra_Vector& temp = *(*S_->Get("temperature", tag_next_).ViewComponent("cell", false))(0); - int num_cols_ = mesh_surf_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int num_cols_ = mesh_surf_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int col = 0; col != num_cols_; ++col) { FieldToColumn_(col, temp, col_temp.ptr()); ColDepthDz_(col, col_depth.ptr(), col_dz.ptr()); @@ -332,7 +332,7 @@ BGCSimple::CommitStep(double told, double tnew, const Tag& tag) // the step as succesful. double dt = tnew - told; - int num_cols_ = mesh_surf_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int num_cols_ = mesh_surf_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int col = 0; col != num_cols_; ++col) { for (int i = 0; i != num_pfts_; ++i) { *pfts_old_[col][i] = *pfts_[col][i]; } } @@ -355,7 +355,7 @@ BGCSimple::AdvanceStep(double t_old, double t_new, bool reinit) // this timestep. This is hackery to get around the fact that PFTs are not // (but should be) in state. AmanziMesh::Entity_ID num_cols_ = - mesh_surf_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + mesh_surf_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (AmanziMesh::Entity_ID col = 0; col != num_cols_; ++col) { for (int i = 0; i != num_pfts_; ++i) { *pfts_[col][i] = *pfts_old_[col][i]; } } @@ -443,12 +443,12 @@ BGCSimple::AdvanceStep(double t_old, double t_new, bool reinit) ColDepthDz_(col, depth_c.ptr(), dz_c.ptr()); // copy over the soil carbon arrays - auto& col_iter = mesh_->cells_of_column(col); + auto col_iter = mesh_->columns.getCells(col); ncells_per_col_ = col_iter.size(); // -- serious cache thrash... --etc for (std::size_t i = 0; i != col_iter.size(); ++i) { - AmanziGeometry::Point centroid = mesh_->cell_centroid(col_iter[i]); + AmanziGeometry::Point centroid = mesh_->getCellCentroid(col_iter[i]); // std::cout << "Col iter col=" << col << ", index i=" << i << ", cell=" << col_iter[i] << " at " << centroid << std::endl; for (int p = 0; p != soil_carbon_pools_[col][i]->nPools; ++p) { soil_carbon_pools_[col][i]->SOM[p] = sc_pools[p][col_iter[i]]; @@ -529,7 +529,7 @@ BGCSimple::FieldToColumn_(AmanziMesh::Entity_ID col, col_vec = Teuchos::ptr(new Epetra_SerialDenseVector(ncells_per_col_)); } - auto& col_iter = mesh_->cells_of_column(col); + auto col_iter = mesh_->columns.getCells(col); for (std::size_t i = 0; i != col_iter.size(); ++i) { (*col_vec)[i] = vec[col_iter[i]]; } } @@ -540,7 +540,7 @@ BGCSimple::FieldToColumn_(AmanziMesh::Entity_ID col, double* col_vec, int ncol) { - auto& col_iter = mesh_->cells_of_column(col); + auto col_iter = mesh_->columns.getCells(col); for (std::size_t i = 0; i != col_iter.size(); ++i) { col_vec[i] = vec[col_iter[i]]; } } @@ -551,29 +551,27 @@ BGCSimple::ColDepthDz_(AmanziMesh::Entity_ID col, Teuchos::Ptr depth, Teuchos::Ptr dz) { - AmanziMesh::Entity_ID f_above = mesh_surf_->entity_get_parent(AmanziMesh::CELL, col); - auto& col_iter = mesh_->cells_of_column(col); + AmanziMesh::Entity_ID f_above = mesh_surf_->getEntityParent(AmanziMesh::Entity_kind::CELL, col); + auto col_iter = mesh_->columns.getCells(col); ncells_per_col_ = col_iter.size(); - AmanziGeometry::Point surf_centroid = mesh_->face_centroid(f_above); + AmanziGeometry::Point surf_centroid = mesh_->getFaceCentroid(f_above); AmanziGeometry::Point neg_z(3); neg_z.set(0., 0., -1); for (std::size_t i = 0; i != col_iter.size(); ++i) { // depth centroid - (*depth)[i] = surf_centroid[2] - mesh_->cell_centroid(col_iter[i])[2]; + (*depth)[i] = surf_centroid[2] - mesh_->getCellCentroid(col_iter[i])[2]; // dz // -- find face_below - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh_->cell_get_faces_and_dirs(col_iter[i], &faces, &dirs); + const auto& [faces, dirs] = mesh_->getCellFacesAndDirections(col_iter[i]); - // -- mimics implementation of build_columns() in Mesh + // -- mimics implementation of buildColumns() in Mesh double mindp = 999.0; AmanziMesh::Entity_ID f_below = -1; for (std::size_t j = 0; j != faces.size(); ++j) { - AmanziGeometry::Point normal = mesh_->face_normal(faces[j]); + AmanziGeometry::Point normal = mesh_->getFaceNormal(faces[j]); if (dirs[j] == -1) normal *= -1; normal /= AmanziGeometry::norm(normal); @@ -585,7 +583,7 @@ BGCSimple::ColDepthDz_(AmanziMesh::Entity_ID col, } // -- fill the val - (*dz)[i] = mesh_->face_centroid(f_above)[2] - mesh_->face_centroid(f_below)[2]; + (*dz)[i] = mesh_->getFaceCentroid(f_above)[2] - mesh_->getFaceCentroid(f_below)[2]; AMANZI_ASSERT((*dz)[i] > 0.); f_above = f_below; } diff --git a/src/pks/biogeochemistry/constitutive_models/carbon/bioturbation_evaluator.cc b/src/pks/biogeochemistry/constitutive_models/carbon/bioturbation_evaluator.cc index 3f099853e..c0eec36b2 100644 --- a/src/pks/biogeochemistry/constitutive_models/carbon/bioturbation_evaluator.cc +++ b/src/pks/biogeochemistry/constitutive_models/carbon/bioturbation_evaluator.cc @@ -56,42 +56,42 @@ BioturbationEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("cell", false); // iterate over columns of the mesh - int ncolumns = mesh.num_columns(); + int ncolumns = mesh.columns.num_columns_all; for (int i = 0; i < ncolumns; ++i) { // grab the column - const AmanziMesh::Entity_ID_List& col = mesh.cells_of_column(i); + const auto& col = mesh.columns.getCells(i); Epetra_SerialDenseVector dC_up(carbon.NumVectors()); Epetra_SerialDenseVector dC_dn(carbon.NumVectors()); // loop over column, getting cell index ci and cell c int ci = 0; - for (AmanziMesh::Entity_ID_List::const_iterator c = col.begin(); c != col.end(); ++c, ++ci) { - double my_z = mesh.cell_centroid(*c)[2]; + for (auto c: col) { + double my_z = mesh.getCellCentroid(c)[2]; double dz_up = 0.; double dz_dn = 0.; if (ci != 0) { - double my_z = mesh.cell_centroid(*c)[2]; + double my_z = mesh.getCellCentroid(c)[2]; int c_up = col[ci - 1]; - dz_up = mesh.cell_centroid(c_up)[2] - my_z; + dz_up = mesh.getCellCentroid(c_up)[2] - my_z; for (int p = 0; p != carbon.NumVectors(); ++p) { - dC_up[p] = (diff[p][*c] + diff[p][c_up]) / 2. * (carbon[p][*c] - carbon[p][c_up]) / dz_up; + dC_up[p] = (diff[p][c] + diff[p][c_up]) / 2. * (carbon[p][c] - carbon[p][c_up]) / dz_up; } } if (ci != col.size() - 1) { int c_dn = col[ci + 1]; - dz_dn = mesh.cell_centroid(c_dn)[2] - my_z; + dz_dn = mesh.getCellCentroid(c_dn)[2] - my_z; for (int p = 0; p != carbon.NumVectors(); ++p) { - dC_dn[p] = (diff[p][*c] + diff[p][c_dn]) / 2. * (carbon[p][c_dn] - carbon[p][*c]) / dz_up; + dC_dn[p] = (diff[p][c] + diff[p][c_dn]) / 2. * (carbon[p][c_dn] - carbon[p][c]) / dz_up; } } double dz = dz_dn == 0. ? dz_up : dz_up == 0. ? dz_dn : (dz_up + dz_dn) / 2.; - for (int p = 0; p != carbon.NumVectors(); ++p) { res_c[p][*c] = (dC_dn[p] - dC_up[p]) / dz; } + for (int p = 0; p != carbon.NumVectors(); ++p) { res_c[p][c] = (dC_dn[p] - dC_up[p]) / dz; } } } } diff --git a/src/pks/deform/volumetric_deformation.cc b/src/pks/deform/volumetric_deformation.cc index ee634725a..4c6958a29 100644 --- a/src/pks/deform/volumetric_deformation.cc +++ b/src/pks/deform/volumetric_deformation.cc @@ -104,19 +104,19 @@ VolumetricDeformation::Setup() // Save both non-const deformable versions of the meshes and create storage // for the vertex coordinates. These are saved to be able to create the // deformed mesh after restart, and additionally must be checkpointed. - int dim = mesh_->space_dimension(); + int dim = mesh_->getSpaceDimension(); mesh_nc_ = S_->GetDeformableMesh(domain_); S_->Require(vertex_loc_key_, tag_next_, vertex_loc_key_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("node", AmanziMesh::NODE, dim); + ->SetComponent("node", AmanziMesh::Entity_kind::NODE, dim); if (tag_next_ != Amanzi::Tags::NEXT) { S_->Require( vertex_loc_key_, Amanzi::Tags::NEXT, vertex_loc_key_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("node", AmanziMesh::NODE, dim); + ->SetComponent("node", AmanziMesh::Entity_kind::NODE, dim); } // note this mesh is never deformed in this PK as all movement is vertical @@ -130,13 +130,13 @@ VolumetricDeformation::Setup() vertex_loc_surf3d_key_, tag_next_, vertex_loc_surf3d_key_) .SetMesh(surf3d_mesh_) ->SetGhosted() - ->SetComponent("node", AmanziMesh::NODE, dim); + ->SetComponent("node", AmanziMesh::Entity_kind::NODE, dim); if (tag_next_ != Amanzi::Tags::NEXT) { S_->Require( vertex_loc_surf3d_key_, Amanzi::Tags::NEXT, vertex_loc_surf3d_key_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("node", AmanziMesh::NODE, dim); + ->SetComponent("node", AmanziMesh::Entity_kind::NODE, dim); } } @@ -144,14 +144,14 @@ VolumetricDeformation::Setup() S_->Require(key_, tag_current_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // Create storage and a function for cell volume change // // Note, this is purely work space and need not be kept, but we put it in // state for debugging purposes. auto& cv_fac = S_->Require(del_cv_key_, tag_next_, name_); - cv_fac.SetMesh(mesh_)->SetComponent("cell", AmanziMesh::CELL, 1); + cv_fac.SetMesh(mesh_)->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); switch (deform_mode_) { case (DEFORM_MODE_DVDT): { @@ -167,19 +167,19 @@ VolumetricDeformation::Setup() requireAtNext(sat_liq_key_, tag_next_, *S_); requireAtCurrent(sat_liq_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(sat_ice_key_, tag_next_, *S_); requireAtCurrent(sat_ice_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(sat_gas_key_, tag_next_, *S_); requireAtCurrent(sat_gas_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(poro_key_, tag_next_, *S_); requireAtCurrent(poro_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); break; } default: { @@ -198,7 +198,7 @@ VolumetricDeformation::Setup() requireAtNext(cv_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // require a copy at the old tag requireAtCurrent(cv_key_, tag_current_, *S_, name_); @@ -217,18 +217,18 @@ VolumetricDeformation::Setup() // // create storage for the nodal deformation // S_->RequireField(Keys::getKey(domain_,"nodal_dz"), name_)->SetMesh(mesh_)->SetGhosted() - // ->SetComponent("node", AmanziMesh::NODE, 1); + // ->SetComponent("node", AmanziMesh::Entity_kind::NODE, 1); break; } case (DEFORM_STRATEGY_MSTK): { requireAtCurrent(sat_ice_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtCurrent(poro_key_, tag_current_, *S_, name_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); break; } @@ -244,13 +244,13 @@ VolumetricDeformation::Setup() requireAtNext(nodal_dz_key_, tag_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("node", AmanziMesh::NODE, 3); + ->SetComponent("node", AmanziMesh::Entity_kind::NODE, 3); // create cell-based storage for deformation of the face above the cell S_->Require(face_above_dz_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); break; } default: { @@ -365,11 +365,10 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) *S_->Get(key_, tag_current_).ViewComponent("cell", false); Epetra_MultiVector& dcell_vol_c = *dcell_vol_vec->ViewComponent("cell", false); - int dim = mesh_->space_dimension(); + int dim = mesh_->getSpaceDimension(); - AmanziMesh::Entity_ID_List cells; - mesh_->get_set_entities( - deform_region_, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = mesh_->getSetEntities( + deform_region_, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : cells) { double frac = 0.; @@ -421,11 +420,10 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) Epetra_MultiVector& dcell_vol_c = *dcell_vol_vec->ViewComponent("cell", false); dcell_vol_c.PutScalar(0.); - int dim = mesh_->space_dimension(); + int dim = mesh_->getSpaceDimension(); - AmanziMesh::Entity_ID_List cells; - mesh_->get_set_entities( - deform_region_, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = mesh_->getSetEntities( + deform_region_, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); double time_factor = dt > time_scale_ ? 1 : dt / time_scale_; for (auto c : cells) { @@ -462,9 +460,8 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) if (strategy_ == DEFORM_STRATEGY_GLOBAL_OPTIMIZATION || strategy_ == DEFORM_STRATEGY_MSTK) { // set up the fixed list fixed_node_list = Teuchos::rcp(new AmanziMesh::Entity_ID_List()); - AmanziMesh::Entity_ID_List nodes; - mesh_->get_set_entities( - "bottom face", AmanziMesh::NODE, AmanziMesh::Parallel_type::OWNED, &nodes); + auto nodes = mesh_->getSetEntities( + "bottom face", AmanziMesh::Entity_kind::NODE, AmanziMesh::Parallel_kind::OWNED); for (auto n : nodes) fixed_node_list->push_back(n); } @@ -488,11 +485,11 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) const Epetra_MultiVector& dcell_vol_c = *dcell_vol_vec->ViewComponent("cell", true); // data needed in vectors - int ncells = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::ALL); - int nnodes = mesh_->num_entities(AmanziMesh::NODE, AmanziMesh::Parallel_type::ALL); + int ncells = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::ALL); + int nnodes = mesh_->getNumEntities(AmanziMesh::Entity_kind::NODE, AmanziMesh::Parallel_kind::ALL); std::vector target_cell_vols(ncells); std::vector min_cell_vols(ncells); - int dim = mesh_->space_dimension(); + int dim = mesh_->getSpaceDimension(); double min_height = std::numeric_limits::max(); for (int c = 0; c != ncells; ++c) { @@ -505,7 +502,7 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) << "V, V_target, V_min " << cv[0][c] << " " << target_cell_vols[c] << " " << min_cell_vols[c] << std::endl; #endif - auto centroid = mesh_->cell_centroid(c); + auto centroid = mesh_->getCellCentroid(c); min_height = std::min(min_height, centroid[dim - 1]); AMANZI_ASSERT(min_cell_vols[c] <= target_cell_vols[c]); @@ -518,11 +515,13 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) AmanziMesh::Entity_ID_List below_node_list; for (unsigned int n = 0; n != nnodes; ++n) { AmanziGeometry::Point nc(3); - mesh_->node_get_coordinates(n, &nc); + nc = mesh_->getNodeCoordinate(n); if (nc[dim - 1] < min_height) below_node_list.emplace_back(n); } - mesh_nc_->deform(target_cell_vols, min_cell_vols, below_node_list, true); + Errors::Message mesg("Volumetric Deformation not implemented in Amanzi"); + Exceptions::amanzi_throw(mesg); + //AmanziMesh::MeshAlgorithms::deform(mesh_nc_,target_cell_vols, min_cell_vols, below_node_list, true); deformed_this_step_ = true; break; } @@ -537,11 +536,11 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) Epetra_MultiVector& nodal_dz = *nodal_dz_vec.ViewComponent("node", "true"); nodal_dz.PutScalar(0.); - int ncols = mesh_->num_columns(false); - int z_index = mesh_->space_dimension() - 1; + int ncols = mesh_->columns.num_columns_owned; + int z_index = mesh_->getSpaceDimension() - 1; for (int col = 0; col != ncols; ++col) { - auto& col_cells = mesh_->cells_of_column(col); - auto& col_faces = mesh_->faces_of_column(col); + auto col_cells = mesh_->columns.getCells(col); + auto col_faces = mesh_->columns.getFaces(col); AMANZI_ASSERT(col_faces.size() == col_cells.size() + 1); // iterate up the column accumulating face displacements @@ -551,7 +550,7 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) int f_above = col_faces[ci]; double dz = - mesh_->face_centroid(f_above)[z_index] - mesh_->face_centroid(f_below)[z_index]; + mesh_->getFaceCentroid(f_above)[z_index] - mesh_->getFaceCentroid(f_below)[z_index]; face_displacement += -dz * dcell_vol_c[0][col_cells[ci]] / cv[0][col_cells[ci]]; AMANZI_ASSERT(face_displacement >= 0.); @@ -565,8 +564,7 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) #endif // shove the face changes into the nodal averages - Entity_ID_List nodes; - mesh_->face_get_nodes(f_above, &nodes); + auto nodes = mesh_->getFaceNodes(f_above); for (auto n : nodes) { nodal_dz[0][n] += face_displacement; nodal_dz[1][n] += dz; @@ -589,18 +587,17 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) } // deform the mesh - Entity_ID_List node_ids(nodal_dz.MyLength()); - AmanziGeometry::Point_List new_positions(nodal_dz.MyLength()); + Entity_ID_View node_ids("node_ids", nodal_dz.MyLength()); + AmanziMesh::Point_View new_positions("new_positions", nodal_dz.MyLength()); for (int n = 0; n != nodal_dz.MyLength(); ++n) { node_ids[n] = n; - mesh_->node_get_coordinates(n, &new_positions[n]); + new_positions[n] = mesh_->getNodeCoordinate(n); AMANZI_ASSERT(nodal_dz[0][n] >= 0.); new_positions[n][2] -= nodal_dz[0][n]; } - AmanziGeometry::Point_List final_positions; for (auto& p : new_positions) { AMANZI_ASSERT(AmanziGeometry::norm(p) >= 0.); } - mesh_nc_->deform(node_ids, new_positions, true, &final_positions); + AmanziMesh::MeshAlgorithms::deform(*mesh_nc_, node_ids, new_positions); deformed_this_step_ = true; // INSERT EXTRA CODE TO UNDEFORM THE MESH FOR MIN_VOLS! break; @@ -615,23 +612,22 @@ VolumetricDeformation::AdvanceStep(double t_old, double t_new, bool reinit) if (surf3d_mesh_nc_ != Teuchos::null) { // done on ALL to avoid lack of communication issues in deform int nsurfnodes = - surf3d_mesh_nc_->num_entities(AmanziMesh::NODE, AmanziMesh::Parallel_type::ALL); + surf3d_mesh_nc_->getNumEntities(AmanziMesh::Entity_kind::NODE, AmanziMesh::Parallel_kind::ALL); - Entity_ID_List surface_nodeids; - AmanziGeometry::Point_List surface_newpos; + Entity_ID_View surface_nodeids("surface_nodeids",nsurfnodes); + AmanziMesh::Point_View surface_newpos("surface_newpos", nsurfnodes); for (int i = 0; i != nsurfnodes; ++i) { // get the coords of the node - AmanziMesh::Entity_ID pnode = surf3d_mesh_nc_->entity_get_parent(AmanziMesh::NODE, i); - int dim = mesh_->space_dimension(); + AmanziMesh::Entity_ID pnode = surf3d_mesh_nc_->getEntityParent(AmanziMesh::Entity_kind::NODE, i); + int dim = mesh_->getSpaceDimension(); AmanziGeometry::Point coord_domain(dim); - mesh_->node_get_coordinates(pnode, &coord_domain); + coord_domain = mesh_->getNodeCoordinate(pnode); - surface_nodeids.push_back(i); - surface_newpos.push_back(coord_domain); + surface_nodeids[i] = i; + surface_newpos[i] = coord_domain; } - AmanziGeometry::Point_List surface_finpos; - surf3d_mesh_nc_->deform(surface_nodeids, surface_newpos, false, &surface_finpos); + AmanziMesh::MeshAlgorithms::deform(*surf3d_mesh_nc_, surface_nodeids, surface_newpos); } // Note, this order is intentionally odd. The deforming cell volume diff --git a/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_threephase_evaluator.cc b/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_threephase_evaluator.cc index 3a65b66e6..09039e2df 100644 --- a/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_threephase_evaluator.cc +++ b/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_threephase_evaluator.cc @@ -93,17 +93,15 @@ ThermalConductivityThreePhaseEvaluator::Evaluate_(const State& S, for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->ThermalConductivity( - poro_v[0][*id], sat_v[0][*id], sat2_v[0][*id], temp_v[0][*id]); + for (auto& id: id_list) { + result_v[0][id] = lcv->second->ThermalConductivity( + poro_v[0][id], sat_v[0][id], sat2_v[0][id], temp_v[0][id]); } } else { std::stringstream m; @@ -145,17 +143,15 @@ ThermalConductivityThreePhaseEvaluator::EvaluatePartialDerivative_( for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->DThermalConductivity_DPorosity( - poro_v[0][*id], sat_v[0][*id], sat2_v[0][*id], temp_v[0][*id]); + for (auto& id: id_list) { + result_v[0][id] = lcv->second->DThermalConductivity_DPorosity( + poro_v[0][id], sat_v[0][id], sat2_v[0][id], temp_v[0][id]); } } else { std::stringstream m; @@ -169,17 +165,15 @@ ThermalConductivityThreePhaseEvaluator::EvaluatePartialDerivative_( for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->DThermalConductivity_DSaturationLiquid( - poro_v[0][*id], sat_v[0][*id], sat2_v[0][*id], temp_v[0][*id]); + for (auto& id: id_list) { + result_v[0][id] = lcv->second->DThermalConductivity_DSaturationLiquid( + poro_v[0][id], sat_v[0][id], sat2_v[0][id], temp_v[0][id]); } } else { std::stringstream m; @@ -193,17 +187,15 @@ ThermalConductivityThreePhaseEvaluator::EvaluatePartialDerivative_( for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->DThermalConductivity_DSaturationIce( - poro_v[0][*id], sat_v[0][*id], sat2_v[0][*id], temp_v[0][*id]); + for (auto id: id_list) { + result_v[0][id] = lcv->second->DThermalConductivity_DSaturationIce( + poro_v[0][id], sat_v[0][id], sat2_v[0][id], temp_v[0][id]); } } else { std::stringstream m; @@ -217,17 +209,15 @@ ThermalConductivityThreePhaseEvaluator::EvaluatePartialDerivative_( for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->DThermalConductivity_DTemperature( - poro_v[0][*id], sat_v[0][*id], sat2_v[0][*id], temp_v[0][*id]); + for (auto& id: id_list) { + result_v[0][id] = lcv->second->DThermalConductivity_DTemperature( + poro_v[0][id], sat_v[0][id], sat2_v[0][id], temp_v[0][id]); } } else { std::stringstream m; diff --git a/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_twophase_evaluator.cc b/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_twophase_evaluator.cc index 2db992f81..b04e4169c 100644 --- a/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_twophase_evaluator.cc +++ b/src/pks/energy/constitutive_relations/thermal_conductivity/thermal_conductivity_twophase_evaluator.cc @@ -79,16 +79,14 @@ ThermalConductivityTwoPhaseEvaluator::Evaluate_(const State& S, for (std::vector::const_iterator lcv = tcs_.begin(); lcv != tcs_.end(); ++lcv) { std::string region_name = lcv->first; - if (mesh->valid_set_name(region_name, AmanziMesh::CELL)) { + if (mesh->isValidSetName(region_name, AmanziMesh::Entity_kind::CELL)) { // get the indices of the domain. - AmanziMesh::Entity_ID_List id_list; - mesh->get_set_entities( - region_name, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &id_list); + auto id_list = mesh->getSetEntities( + region_name, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // loop over indices - for (AmanziMesh::Entity_ID_List::const_iterator id = id_list.begin(); id != id_list.end(); - ++id) { - result_v[0][*id] = lcv->second->ThermalConductivity(poro_v[0][*id], sat_v[0][*id]); + for (auto& id: id_list) { + result_v[0][id] = lcv->second->ThermalConductivity(poro_v[0][id], sat_v[0][id]); } } else { std::stringstream m; diff --git a/src/pks/energy/energy_base_physics.cc b/src/pks/energy/energy_base_physics.cc index bfd19f35f..625ca8af7 100644 --- a/src/pks/energy/energy_base_physics.cc +++ b/src/pks/energy/energy_base_physics.cc @@ -216,7 +216,7 @@ EnergyBase::ApplyDirichletBCsToEnthalpy_(const Tag& tag) // diffusive flux BC AmanziMesh::Entity_ID c = getFaceOnBoundaryInternalCell(*mesh_, f); const auto& Acc = matrix_diff_->local_op()->matrices_shadow[f]; - T_bf[0][bf] = (Acc(0, 0) * T_c[0][c] - bc_values()[f] * mesh_->face_area(f)) / Acc(0, 0); + T_bf[0][bf] = (Acc(0, 0) * T_c[0][c] - bc_values()[f] * mesh_->getFaceArea(f)) / Acc(0, 0); } } } diff --git a/src/pks/energy/energy_base_pk.cc b/src/pks/energy/energy_base_pk.cc index b77479316..cac6d7c70 100644 --- a/src/pks/energy/energy_base_pk.cc +++ b/src/pks/energy/energy_base_pk.cc @@ -113,7 +113,7 @@ EnergyBase::SetupPhysicalEvaluators_() requireAtNext(conserved_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireDerivative( conserved_key_, tag_next_, key_, tag_next_); @@ -121,7 +121,7 @@ EnergyBase::SetupPhysicalEvaluators_() requireAtNext(conductivity_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } // ------------------------------------------------------------- @@ -134,7 +134,7 @@ EnergyBase::SetupEnergy_() // Get data for special-case entities. requireAtNext(cell_vol_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->Require("atmospheric_pressure", Tags::DEFAULT); @@ -142,7 +142,7 @@ EnergyBase::SetupEnergy_() if (is_source_term_) { requireAtNext(source_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); if (is_source_term_differentiable_ && (!is_source_term_finite_differentiable_)) { // NOTE, the following line is commented out because of the bug, amanzi/ats#167 @@ -151,7 +151,7 @@ EnergyBase::SetupEnergy_() S_->RequireDerivative( source_key_, tag_next_, key_, tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // NOTE, remove SetMesh/AddComponent lines after fixing amanzi/ats#167. // The mesh should get set by the evaluator, but when // the evaluator isn't actually differentiable, it @@ -170,7 +170,7 @@ EnergyBase::SetupEnergy_() bc_diff_flux_ = bc_factory.CreateDiffusiveFlux(); bc_flux_ = bc_factory.CreateTotalFlux(); - bc_adv_ = Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::FACE, WhetStone::DOF_Type::SCALAR)); + bc_adv_ = Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::Entity_kind::FACE, WhetStone::DOF_Type::SCALAR)); // -- nonlinear coefficient std::string method_name = @@ -190,12 +190,12 @@ EnergyBase::SetupEnergy_() S_->Require(uw_conductivity_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } else if (coef_location == "standard: cell") { S_->Require(uw_conductivity_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { Errors::Message message("Unknown upwind coefficient location in energy."); Exceptions::amanzi_throw(message); @@ -263,7 +263,7 @@ EnergyBase::SetupEnergy_() S_->Require(duw_conductivity_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); upwinding_deriv_ = Teuchos::rcp(new Operators::UpwindTotalFlux(name_, tag_next_, energy_flux_key_, 1.e-8)); @@ -313,8 +313,8 @@ EnergyBase::SetupEnergy_() requireAtNext(enthalpy_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); S_->RequireDerivative( enthalpy_key_, tag_next_, key_, tag_next_) .SetGhosted(); @@ -323,21 +323,21 @@ EnergyBase::SetupEnergy_() requireAtNext(adv_energy_flux_key_, tag_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } else { // -- enthalpy data, evaluator requireAtCurrent(enthalpy_key_, tag_current_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); // -- diagnostic for advected energy requireAtCurrent(adv_energy_flux_key_, tag_current_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } } @@ -355,7 +355,7 @@ EnergyBase::SetupEnergy_() *plist_, domain_surf, "surface-subsurface energy flux", "surface_subsurface_energy_flux"); S_->Require(ss_flux_key_, tag_next_) .SetMesh(S_->GetMesh(domain_surf)) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } // -- coupled to a surface via a Dirichlet condition @@ -370,7 +370,7 @@ EnergyBase::SetupEnergy_() ss_primary_key_ = Keys::readKey(*plist_, domain_surf, "temperature", "temperature"); S_->Require(ss_primary_key_, tag_next_) .SetMesh(S_->GetMesh(domain_surf)) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } decoupled_from_subsurface_ = @@ -385,7 +385,7 @@ EnergyBase::SetupEnergy_() // Require the primary variable CompositeVectorSpace matrix_cvs = matrix_->RangeMap(); - matrix_cvs.AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + matrix_cvs.AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); S_->Require(key_, tag_next_, name_) .Update(matrix_cvs) ->SetGhosted(); @@ -394,20 +394,20 @@ EnergyBase::SetupEnergy_() requireAtNext(flux_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("face", AmanziMesh::FACE, 1); + ->AddComponent("face", AmanziMesh::Entity_kind::FACE, 1); // and at the current time, where it is a copy evaluator requireAtCurrent(flux_key_, tag_current_, *S_, name_); // require a water content field -- used for computing energy density in the // error norm - requireAtNext(wc_key_, tag_next_, *S_).SetMesh(mesh_)->AddComponent("cell", AmanziMesh::CELL, 1); + requireAtNext(wc_key_, tag_next_, *S_).SetMesh(mesh_)->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtCurrent(wc_key_, tag_current_, *S_, name_); // Require fields for the energy fluxes requireAtNext(energy_flux_key_, tag_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); // Globalization and other timestep control flags modify_predictor_for_freezing_ = plist_->get("modify predictor for freezing", false); @@ -584,7 +584,7 @@ EnergyBase::UpdateBoundaryConditions_(const Tag& tag) int ncells_surface = temp.MyLength(); for (int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face - AmanziMesh::Entity_ID f = surface->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surface->getEntityParent(AmanziMesh::Entity_kind::CELL, c); // -- set that value to dirichlet markers[f] = Operators::OPERATOR_BC_DIRICHLET; @@ -604,12 +604,12 @@ EnergyBase::UpdateBoundaryConditions_(const Tag& tag) int ncells_surface = flux.MyLength(); for (int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face - AmanziMesh::Entity_ID f = surface->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surface->getEntityParent(AmanziMesh::Entity_kind::CELL, c); // -- set that value to Neumann markers[f] = Operators::OPERATOR_BC_NEUMANN; // flux provided by the coupler is in units of J / s, whereas Neumann BCs are J/s/A - values[f] = flux[0][c] / mesh_->face_area(f); + values[f] = flux[0][c] / mesh_->getFaceArea(f); // -- mark advective BCs as Dirichlet: this ensures the surface // temperature is picked up and advective fluxes are treated @@ -619,11 +619,10 @@ EnergyBase::UpdateBoundaryConditions_(const Tag& tag) } // mark all remaining boundary conditions as zero diffusive flux conditions - AmanziMesh::Entity_ID_List cells; - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (int f = 0; f < nfaces_owned; f++) { if (markers[f] == Operators::OPERATOR_BC_NONE) { - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int ncells = cells.size(); if (ncells == 1) { @@ -692,14 +691,14 @@ EnergyBase::IsAdmissible(Teuchos::RCP up) double minT_l = minT; double maxT_l = maxT; - mesh_->get_comm()->MaxAll(&maxT_l, &maxT, 1); - mesh_->get_comm()->MinAll(&minT_l, &minT, 1); + mesh_->getComm()->MaxAll(&maxT_l, &maxT, 1); + mesh_->getComm()->MinAll(&minT_l, &minT, 1); if (vo_->os_OK(Teuchos::VERB_HIGH)) { *vo_->os() << " Admissible T? (min/max): " << minT << ", " << maxT << std::endl; } - Teuchos::RCP comm_p = mesh_->get_comm(); + Teuchos::RCP comm_p = mesh_->getComm(); Teuchos::RCP mpi_comm_p = Teuchos::rcp_dynamic_cast(comm_p); const MPI_Comm& comm = mpi_comm_p->Comm(); @@ -819,8 +818,7 @@ EnergyBase::CalculateConsistentFaces(const Teuchos::Ptr& u) int f_owned = u_f.MyLength(); for (int f = 0; f != f_owned; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int ncells = cells.size(); double face_value = 0.0; @@ -881,7 +879,7 @@ EnergyBase::ModifyCorrection(double h, AmanziMesh::Entity_ID c = getFaceOnBoundaryInternalCell(*mesh_, f); const auto& Acc = matrix_diff_->local_op()->matrices_shadow[f]; double T_bf_val = - (Acc(0, 0) * (T_c[0][c] - dT_c[0][c]) - bc_values()[f] * mesh_->face_area(f)) / Acc(0, 0); + (Acc(0, 0) * (T_c[0][c] - dT_c[0][c]) - bc_values()[f] * mesh_->getFaceArea(f)) / Acc(0, 0); dT_bf[0][bf] = T_bf[0][bf] - T_bf_val; } } @@ -909,7 +907,7 @@ EnergyBase::ModifyCorrection(double h, } } } - mesh_->get_comm()->SumAll(&my_limited, &n_limited, 1); + mesh_->getComm()->SumAll(&my_limited, &n_limited, 1); } if (n_limited > 0) { diff --git a/src/pks/energy/energy_base_ti.cc b/src/pks/energy/energy_base_ti.cc index 83938268e..f7b8e60f9 100644 --- a/src/pks/energy/energy_base_ti.cc +++ b/src/pks/energy/energy_base_ti.cc @@ -295,7 +295,7 @@ EnergyBase::ErrorNorm(Teuchos::RCP u, Teuchos::RCP dvec = res->Data(); double h = S_->get_time(tag_next_) - S_->get_time(tag_current_); - Teuchos::RCP comm_p = mesh_->get_comm(); + Teuchos::RCP comm_p = mesh_->getComm(); Teuchos::RCP mpi_comm_p = Teuchos::rcp_dynamic_cast(comm_p); const MPI_Comm& comm = mpi_comm_p->Comm(); @@ -327,8 +327,7 @@ EnergyBase::ErrorNorm(Teuchos::RCP u, Teuchos::RCPsize(*comp, false); for (unsigned int f = 0; f != nfaces; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::OWNED); double cv_min = cells.size() == 1 ? cv[0][cells[0]] : std::min(cv[0][cells[0]], cv[0][cells[1]]); double mass_min = cells.size() == 1 ? wc[0][cells[0]] / cv[0][cells[0]] : diff --git a/src/pks/energy/energy_surface_ice.cc b/src/pks/energy/energy_surface_ice.cc index f897e9375..d76e1682d 100644 --- a/src/pks/energy/energy_surface_ice.cc +++ b/src/pks/energy/energy_surface_ice.cc @@ -76,26 +76,26 @@ EnergySurfaceIce::SetupPhysicalEvaluators_() S_->Require(key_ss, tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // -- ensure enthalpy exists at the new time requireAtNext(enthalpy_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // -- and on the subsurface requireAtNext(Keys::getKey(domain_ss_, "enthalpy"), tag_next_, *S_) .SetMesh(S_->GetMesh(domain_ss_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } if (coupled_to_subsurface_via_temp_) { // -- energy source term from subsurface S_->Require("surface_subsurface_energy_flux", tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator("surface_subsurface_energy_flux", tag_next_); } } @@ -132,13 +132,13 @@ EnergySurfaceIce::Initialize() Teuchos::RCP subsurf_temp = S_->GetPtr(key_ss, tag_next_); - auto ncells_surface = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + auto ncells_surface = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (subsurf_temp->HasComponent("face")) { const Epetra_MultiVector& temp = *subsurf_temp->ViewComponent("face", false); for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face and neighboring cell - AmanziMesh::Entity_ID f = mesh_->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); surf_temp[0][c] = temp[0][f]; } } else if (subsurf_temp->HasComponent("boundary_face")) { @@ -147,8 +147,8 @@ EnergySurfaceIce::Initialize() for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face and neighboring cell - AmanziMesh::Entity_ID f = mesh_->entity_get_parent(AmanziMesh::CELL, c); - int bf = mesh_domain->exterior_face_map(false).LID(mesh_domain->face_map(false).GID(f)); + AmanziMesh::Entity_ID f = mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); + int bf = mesh_domain->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false).LID(mesh_domain->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f)); if (bf >= 0) surf_temp[0][c] = temp[0][bf]; } } @@ -166,9 +166,9 @@ EnergySurfaceIce::Initialize() S_->GetPtrW(key_, tag_next_, name_); Epetra_MultiVector& surf_temp = *surf_temp_cv->ViewComponent("cell", false); - auto ncells_surface = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + auto ncells_surface = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int c = 0; c != ncells_surface; ++c) { - int id = mesh_->cell_map(false).GID(c); + int id = mesh_->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c); std::stringstream name; name << "surface_column_" << id; const Epetra_MultiVector& temp = @@ -218,7 +218,6 @@ EnergySurfaceIce::AddSources_(const Tag& tag, const Teuchos::PtrGet(Keys::getKey(domain_, "ponded_depth"), tag) .ViewComponent("cell", false); - AmanziMesh::Entity_ID_List cells; unsigned int ncells = g_c.MyLength(); const auto& mesh_ss = *S_->GetMesh(domain_ss_); for (unsigned int c = 0; c != ncells; ++c) { @@ -227,8 +226,8 @@ EnergySurfaceIce::AddSources_(const Tag& tag, const Teuchos::Ptr 0.) { // exfiltration // get the subsurface's enthalpy - AmanziMesh::Entity_ID f = mesh_->entity_get_parent(AmanziMesh::CELL, c); - mesh_ss.face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + AmanziMesh::Entity_ID f = mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); + auto cells = mesh_ss.getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); g_c[0][c] -= flux * enth_subsurf[0][cells[0]]; diff --git a/src/pks/energy/energy_three_phase.cc b/src/pks/energy/energy_three_phase.cc index d76fbf929..f95205f82 100644 --- a/src/pks/energy/energy_three_phase.cc +++ b/src/pks/energy/energy_three_phase.cc @@ -53,7 +53,7 @@ ThreePhase::Initialize() double r_sq = std::pow(0.5099, 2); Epetra_MultiVector& temp_c = *temp->ViewComponent("cell", false); for (int c = 0; c != temp_c.MyLength(); ++c) { - AmanziGeometry::Point centroid = mesh_->cell_centroid(c); + AmanziGeometry::Point centroid = mesh_->getCellCentroid(c); double circle_y = centroid[1] >= 0.5 ? 1.1 : -0.1; double dist = std::pow(centroid[0] - 0.5, 2) + std::pow(centroid[1] - circle_y, 2); diff --git a/src/pks/flow/constitutive_relations/elevation/depth_model.cc b/src/pks/flow/constitutive_relations/elevation/depth_model.cc index bbc73c901..2e022edc8 100644 --- a/src/pks/flow/constitutive_relations/elevation/depth_model.cc +++ b/src/pks/flow/constitutive_relations/elevation/depth_model.cc @@ -23,7 +23,7 @@ DepthModel(const AmanziMesh::Mesh& mesh, Epetra_MultiVector& depth) { depth.PutScalar(-1); AMANZI_ASSERT(depth.MyLength() == - mesh.num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED)); + mesh.getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED)); for (int c = 0; c != depth.MyLength(); ++c) { if (depth[0][c] <= 0.) { DepthModel_Cell(c, mesh, depth); } } @@ -33,16 +33,15 @@ DepthModel(const AmanziMesh::Mesh& mesh, Epetra_MultiVector& depth) void DepthModel_Cell(int c, const AmanziMesh::Mesh& mesh, Epetra_MultiVector& depth) { - int z_dim = mesh.space_dimension() - 1; - int c_above = mesh.cell_get_cell_above(c); + int z_dim = mesh.getSpaceDimension() - 1; + assert(false); + int c_above = 0; //mesh.cell_get_cell_above(c); if (c_above == -1) { // top cell, find the face above - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh.cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh.getCellFacesAndDirections(c); int f_above = -1; for (auto f : faces) { - AmanziGeometry::Point face_normal = mesh.face_normal(f, false, c); + AmanziGeometry::Point face_normal = mesh.getFaceNormal(f, c); face_normal /= AmanziGeometry::norm(face_normal); if (face_normal[z_dim] > 1.e-10) { f_above = f; @@ -51,14 +50,14 @@ DepthModel_Cell(int c, const AmanziMesh::Mesh& mesh, Epetra_MultiVector& depth) } // get the depth - depth[0][c] = mesh.face_centroid(f_above)[z_dim] - mesh.cell_centroid(c)[z_dim]; + depth[0][c] = mesh.getFaceCentroid(f_above)[z_dim] - mesh.getCellCentroid(c)[z_dim]; return; } if (depth[0][c_above] <= 0) { DepthModel_Cell(c_above, mesh, depth); } AMANZI_ASSERT(depth[0][c_above] > 0.); depth[0][c] = - depth[0][c_above] + mesh.cell_centroid(c_above)[z_dim] - mesh.cell_centroid(c)[z_dim]; + depth[0][c_above] + mesh.getCellCentroid(c_above)[z_dim] - mesh.getCellCentroid(c)[z_dim]; return; } diff --git a/src/pks/flow/constitutive_relations/elevation/elevation_evaluator.cc b/src/pks/flow/constitutive_relations/elevation/elevation_evaluator.cc index f8cc4958b..f6d216928 100644 --- a/src/pks/flow/constitutive_relations/elevation/elevation_evaluator.cc +++ b/src/pks/flow/constitutive_relations/elevation/elevation_evaluator.cc @@ -52,18 +52,17 @@ ElevationEvaluator::Evaluate_(const State& S, const std::vectorHasComponent("boundary_face")) { - const Epetra_Map& vandelay_map = slope->Mesh()->exterior_face_map(false); - const Epetra_Map& face_map = slope->Mesh()->face_map(false); + const Epetra_Map& vandelay_map = slope->Mesh()->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = slope->Mesh()->getMap(AmanziMesh::Entity_kind::FACE,false); Epetra_MultiVector& slope_bf = *slope->ViewComponent("boundary_face", false); const Epetra_MultiVector& slope_c = *slope->ViewComponent("cell", false); // calculate boundary face values - AmanziMesh::Entity_ID_List cells; int nbfaces = slope_bf.MyLength(); for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - slope->Mesh()->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = slope->Mesh()->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); slope_bf[0][bf] = slope_c[0][cells[0]]; diff --git a/src/pks/flow/constitutive_relations/elevation/elevation_evaluator_column.cc b/src/pks/flow/constitutive_relations/elevation/elevation_evaluator_column.cc index 01e775d89..1b2e37b73 100644 --- a/src/pks/flow/constitutive_relations/elevation/elevation_evaluator_column.cc +++ b/src/pks/flow/constitutive_relations/elevation/elevation_evaluator_column.cc @@ -65,14 +65,14 @@ ColumnElevationEvaluator::EvaluateElevationAndSlope_(const State& S, std::vector my_centroid; auto domain_set = S.GetDomainSet(dset_name_); - const Epetra_Map& cell_map = S.GetMesh(surface_domain_)->cell_map(false); + const Epetra_Map& cell_map = S.GetMesh(surface_domain_)->getMap(AmanziMesh::Entity_kind::CELL,false); AMANZI_ASSERT(domain_set->size() == cell_map.NumMyElements()); AMANZI_ASSERT(domain_set->size() == elev_c.MyLength()); for (const auto& domain : *domain_set) { int gid = Keys::getDomainSetIndex(domain); int c = cell_map.LID(gid); - auto coord = S.GetMesh(domain)->face_centroid(0); // 0 is the id of top face of the column mesh + auto coord = S.GetMesh(domain)->getFaceCentroid(0); // 0 is the id of top face of the column mesh elev_c[0][c] = coord[2]; } @@ -82,29 +82,28 @@ ColumnElevationEvaluator::EvaluateElevationAndSlope_(const State& S, // get all cell centroids for (int c = 0; c != ncells; ++c) { - int id = S.GetMesh(surface_domain_)->cell_map(true).GID(c); - AmanziGeometry::Point P1 = S.GetMesh(surface_domain_)->cell_centroid(c); + int id = S.GetMesh(surface_domain_)->getMap(AmanziMesh::Entity_kind::CELL,true).GID(c); + AmanziGeometry::Point P1 = S.GetMesh(surface_domain_)->getCellCentroid(c); P1.set(P1[0], P1[1], elev_ngb_c[0][c]); my_centroid.push_back(P1); } // get neighboring cell ids for (int c = 0; c != ncells; c++) { - AmanziMesh::Entity_ID_List nadj_cellids; - S.GetMesh(surface_domain_) - ->cell_get_face_adj_cells(c, AmanziMesh::Parallel_type::ALL, &nadj_cellids); - int nface_pcell = S.GetMesh(surface_domain_)->cell_get_num_faces(c); + auto nadj_cellids = AmanziMesh::MeshAlgorithms::getCellFaceAdjacentCells( + *S.GetMesh(surface_domain_), c, AmanziMesh::Parallel_kind::ALL); + int nface_pcell = S.GetMesh(surface_domain_)->getCellNumFaces(c); int ngb_cells = nadj_cellids.size(); std::vector ngb_centroids(ngb_cells); // get the neighboring cell's centroids for (unsigned i = 0; i < ngb_cells; i++) { - AmanziGeometry::Point P2 = S.GetMesh(surface_domain_)->cell_centroid(nadj_cellids[i]); + AmanziGeometry::Point P2 = S.GetMesh(surface_domain_)->getCellCentroid(nadj_cellids[i]); ngb_centroids[i].set(P2[0], P2[1], elev_ngb_c[0][nadj_cellids[i]]); } - int id = S.GetMesh(surface_domain_)->cell_map(false).GID(c); + int id = S.GetMesh(surface_domain_)->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c); Key my_name = Keys::getDomainInSet(dset_name_, id); std::vector Normal; @@ -119,7 +118,7 @@ ColumnElevationEvaluator::EvaluateElevationAndSlope_(const State& S, Normal.push_back(N); } - AmanziGeometry::Point fnor = S.GetMesh(my_name)->face_normal(0); //0 is the id of top face + AmanziGeometry::Point fnor = S.GetMesh(my_name)->getFaceNormal(0); //0 is the id of top face Nor_avg = (nface_pcell - Normal.size()) * fnor; for (int i = 0; i < Normal.size(); i++) Nor_avg += Normal[i]; @@ -141,8 +140,7 @@ ColumnElevationEvaluator::EvaluateElevationAndSlope_(const State& S, int nfaces = elev_f.MyLength(); for (int f = 0; f != nfaces; ++f) { - AmanziMesh::Entity_ID_List nadj_cellids; - S.GetMesh(surface_domain_)->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &nadj_cellids); + auto nadj_cellids = S.GetMesh(surface_domain_)->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); double ef = 0; for (int i = 0; i < nadj_cellids.size(); i++) { ef += elev_ngb_c[0][nadj_cellids[i]]; } elev_f[0][f] = ef / nadj_cellids.size(); diff --git a/src/pks/flow/constitutive_relations/elevation/meshed_elevation_evaluator.cc b/src/pks/flow/constitutive_relations/elevation/meshed_elevation_evaluator.cc index 2ac0b0dbd..39b57066b 100644 --- a/src/pks/flow/constitutive_relations/elevation/meshed_elevation_evaluator.cc +++ b/src/pks/flow/constitutive_relations/elevation/meshed_elevation_evaluator.cc @@ -97,22 +97,22 @@ MeshedElevationEvaluator::EvaluateElevationAndSlope_(const State& S, // Get the elevation and slope values from the domain mesh. Key domain = Keys::getDomain(my_keys_.front().first); const auto& surface_mesh = S.GetMesh(domain); - const auto& parent_mesh = surface_mesh->parent(); + const auto& parent_mesh = surface_mesh->getParentMesh(); AMANZI_ASSERT(parent_mesh != Teuchos::null); - AMANZI_ASSERT(parent_mesh->space_dimension() == 3); + AMANZI_ASSERT(parent_mesh->getSpaceDimension() == 3); - if (parent_mesh->manifold_dimension() == 3) { + if (parent_mesh->getManifoldDimension() == 3) { // surface mesh is extraction int ncells = elev_c.MyLength(); for (int c = 0; c != ncells; ++c) { // Set the elevation on cells by getting the corresponding face and its // centroid. - auto domain_face = surface_mesh->entity_get_parent(AmanziMesh::CELL, c); - elev_c[0][c] = parent_mesh->face_centroid(domain_face, true)[2]; + auto domain_face = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, c); + elev_c[0][c] = parent_mesh->getFaceCentroid(domain_face)[2]; // Set the slope and aspect using the upward normal of the corresponding // face. - AmanziGeometry::Point normal = parent_mesh->face_normal(domain_face); + AmanziGeometry::Point normal = parent_mesh->getFaceNormal(domain_face); Impl::slope_aspect(normal, slope_c[0][c], aspect_c[0][c]); } @@ -120,39 +120,37 @@ MeshedElevationEvaluator::EvaluateElevationAndSlope_(const State& S, // averaging. if (elev->HasComponent("face")) { Epetra_MultiVector& elev_f = *elev->ViewComponent("face", false); - AmanziMesh::Entity_ID_List surface_nodes(2); AmanziMesh::Entity_ID node0, node1; AmanziGeometry::Point coord0(3); AmanziGeometry::Point coord1(3); int nfaces = elev_f.MyLength(); for (int f = 0; f != nfaces; ++f) { - surface_mesh->face_get_nodes(f, &surface_nodes); - node0 = surface_mesh->entity_get_parent(AmanziMesh::NODE, surface_nodes[0]); - node1 = surface_mesh->entity_get_parent(AmanziMesh::NODE, surface_nodes[1]); - parent_mesh->node_get_coordinates(node0, &coord0); - parent_mesh->node_get_coordinates(node1, &coord1); + auto surface_nodes = surface_mesh->getFaceNodes(f); + node0 = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::NODE, surface_nodes[0]); + node1 = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::NODE, surface_nodes[1]); + coord0 = parent_mesh->getNodeCoordinate(node0); + coord1 = parent_mesh->getNodeCoordinate(node1); elev_f[0][f] = (coord0[2] + coord1[2]) / 2.0; } } if (elev->HasComponent("boundary_face")) { - const Epetra_Map& vandalay_map = surface_mesh->exterior_face_map(false); - const Epetra_Map& face_map = surface_mesh->face_map(false); + const Epetra_Map& vandalay_map = surface_mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = surface_mesh->getMap(AmanziMesh::Entity_kind::FACE,false); Epetra_MultiVector& elev_bf = *elev->ViewComponent("boundary_face", false); - AmanziMesh::Entity_ID_List surface_nodes(2); AmanziMesh::Entity_ID node0, node1; AmanziGeometry::Point coord0(3); AmanziGeometry::Point coord1(3); for (int bf = 0; bf != elev_bf.MyLength(); ++bf) { AmanziMesh::Entity_ID f = AmanziMesh::getBoundaryFaceFace(*surface_mesh, bf); - surface_mesh->face_get_nodes(f, &surface_nodes); - node0 = surface_mesh->entity_get_parent(AmanziMesh::NODE, surface_nodes[0]); - node1 = surface_mesh->entity_get_parent(AmanziMesh::NODE, surface_nodes[1]); - parent_mesh->node_get_coordinates(node0, &coord0); - parent_mesh->node_get_coordinates(node1, &coord1); + auto surface_nodes = surface_mesh->getFaceNodes(f); + node0 = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::NODE, surface_nodes[0]); + node1 = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::NODE, surface_nodes[1]); + coord0 = parent_mesh->getNodeCoordinate(node0); + coord1 = parent_mesh->getNodeCoordinate(node1); elev_bf[0][bf] = (coord0[2] + coord1[2]) / 2.0; } } @@ -163,20 +161,19 @@ MeshedElevationEvaluator::EvaluateElevationAndSlope_(const State& S, for (int c = 0; c != ncells; ++c) { // Set the elevation on cells by getting the corresponding face and its // centroid. - auto domain_cell = surface_mesh->entity_get_parent(AmanziMesh::CELL, c); - elev_c[0][c] = parent_mesh->cell_centroid(domain_cell, true)[2]; + auto domain_cell = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, c); + elev_c[0][c] = parent_mesh->getCellCentroid(domain_cell)[2]; // Figure out the upward normal using edges. // -- faces of the cell AmanziGeometry::Point normal(0., 0., 0.); - AmanziMesh::Entity_ID_List faces; - parent_mesh->cell_get_faces(domain_cell, &faces); + auto faces = parent_mesh->getCellFaces(domain_cell); // -- Get the normals of all faces of the surface cell. int count = faces.size(); std::vector normals(count); for (int lcv = 0; lcv != count; ++lcv) { - normals[lcv] = parent_mesh->face_normal(faces[lcv], false, domain_cell); + normals[lcv] = parent_mesh->getFaceNormal(faces[lcv], domain_cell); } // -- Average the cross product of successive faces to get a cell normal. @@ -200,8 +197,8 @@ MeshedElevationEvaluator::EvaluateElevationAndSlope_(const State& S, int nfaces = elev_f.MyLength(); for (int f = 0; f != nfaces; ++f) { // Note that a surface face is a surface mesh's face. - AmanziMesh::Entity_ID domain_face = surface_mesh->entity_get_parent(AmanziMesh::FACE, f); - AmanziGeometry::Point x = parent_mesh->face_centroid(domain_face, true); + AmanziMesh::Entity_ID domain_face = surface_mesh->getEntityParent(AmanziMesh::Entity_kind::FACE, f); + AmanziGeometry::Point x = parent_mesh->getFaceCentroid(domain_face); elev_f[0][f] = x[2]; } } diff --git a/src/pks/flow/constitutive_relations/overland_conductivity/manning_coefficient_litter_evaluator.cc b/src/pks/flow/constitutive_relations/overland_conductivity/manning_coefficient_litter_evaluator.cc index 41e79f454..b3ccab93d 100644 --- a/src/pks/flow/constitutive_relations/overland_conductivity/manning_coefficient_litter_evaluator.cc +++ b/src/pks/flow/constitutive_relations/overland_conductivity/manning_coefficient_litter_evaluator.cc @@ -99,15 +99,14 @@ ManningCoefficientLitterEvaluator::Evaluate_(const State& S, // Need to get boundary face's inner cell to specify the WRM. Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); int ncomp = result[0]->size("boundary_face", false); for (int bf = 0; bf != ncomp; ++bf) { // given a boundary face, we need the internal cell to choose the right model AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*models_->first)[cells[0]]; @@ -164,16 +163,15 @@ ManningCoefficientLitterEvaluator::EvaluatePartialDerivative_( // Need to get boundary face's inner cell to specify the WRM. Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); int ncomp = result[0]->size("boundary_face", false); if (wrt_key == ld_key_) { for (int bf = 0; bf != ncomp; ++bf) { // given a boundary face, we need the internal cell to choose the right model AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*models_->first)[cells[0]]; @@ -185,7 +183,7 @@ ManningCoefficientLitterEvaluator::EvaluatePartialDerivative_( for (int bf = 0; bf != ncomp; ++bf) { // given a boundary face, we need the internal cell to choose the right model AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*models_->first)[cells[0]]; @@ -230,7 +228,7 @@ createManningCoefPartition(Teuchos::ParameterList& plist) } Teuchos::RCP part = - Teuchos::rcp(new Functions::MeshPartition(AmanziMesh::CELL, region_list)); + Teuchos::rcp(new Functions::MeshPartition(AmanziMesh::Entity_kind::CELL, region_list)); return Teuchos::rcp(new ManningCoefPartition(part, models)); } diff --git a/src/pks/flow/constitutive_relations/sources/distributed_tiles_evaluator.cc b/src/pks/flow/constitutive_relations/sources/distributed_tiles_evaluator.cc index 36814553a..08df0763d 100644 --- a/src/pks/flow/constitutive_relations/sources/distributed_tiles_evaluator.cc +++ b/src/pks/flow/constitutive_relations/sources/distributed_tiles_evaluator.cc @@ -123,7 +123,7 @@ DistributedTilesRateEvaluator::Update_(State& S) total = 0.; for (AmanziMesh::Entity_ID c = 0; c != ncells; ++c) { total += sub_sink[0][c] * cv[0][c]; } - Teuchos::RCP comm_p = S.GetMesh(domain_)->get_comm(); + Teuchos::RCP comm_p = S.GetMesh(domain_)->getComm(); Teuchos::RCP mpi_comm_p = Teuchos::rcp_dynamic_cast(comm_p); const MPI_Comm& comm = mpi_comm_p->Comm(); diff --git a/src/pks/flow/constitutive_relations/wrm/rel_perm_evaluator.cc b/src/pks/flow/constitutive_relations/wrm/rel_perm_evaluator.cc index db7d0e7a4..099249f80 100644 --- a/src/pks/flow/constitutive_relations/wrm/rel_perm_evaluator.cc +++ b/src/pks/flow/constitutive_relations/wrm/rel_perm_evaluator.cc @@ -118,7 +118,7 @@ RelPermEvaluator::EnsureCompatibility_ToDeps_(State& S) } else { CompositeVectorSpace surf_kr_fac; surf_kr_fac.SetMesh(S.GetMesh(Keys::getDomain(dep.first))) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(dep.first, dep.second).Update(surf_kr_fac); } } @@ -157,16 +157,15 @@ RelPermEvaluator::Evaluate_(const State& S, const std::vector& Epetra_MultiVector& res_bf = *result[0]->ViewComponent("boundary_face", false); Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); // Evaluate the model to calculate krel. - AmanziMesh::Entity_ID_List cells; int nbfaces = res_bf.MyLength(); for (unsigned int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*wrms_->first)[cells[0]]; @@ -198,14 +197,14 @@ RelPermEvaluator::Evaluate_(const State& S, const std::vector& Teuchos::RCP surf_mesh = S.GetMesh(surf_domain_); Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); unsigned int nsurf_cells = - surf_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + surf_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int sc = 0; sc != nsurf_cells; ++sc) { // need to map from surface quantity on cells to subsurface boundary_face quantity - AmanziMesh::Entity_ID f = surf_mesh->entity_get_parent(AmanziMesh::CELL, sc); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); AmanziMesh::Entity_ID bf = vandelay_map.LID(face_map.GID(f)); res_bf[0][bf] = std::max(surf_kr[0][sc], min_val_); diff --git a/src/pks/flow/constitutive_relations/wrm/rel_perm_sutraice_evaluator.cc b/src/pks/flow/constitutive_relations/wrm/rel_perm_sutraice_evaluator.cc index 2724bb439..9d4c490fe 100644 --- a/src/pks/flow/constitutive_relations/wrm/rel_perm_sutraice_evaluator.cc +++ b/src/pks/flow/constitutive_relations/wrm/rel_perm_sutraice_evaluator.cc @@ -124,7 +124,7 @@ RelPermSutraIceEvaluator::EnsureCompatibility_ToDeps_(State& S) } else { CompositeVectorSpace surf_kr_fac; surf_kr_fac.SetMesh(S.GetMesh(Keys::getDomain(dep.first))) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(dep.first, dep.second).Update(surf_kr_fac); } } @@ -170,16 +170,15 @@ RelPermSutraIceEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("boundary_face", false); Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); // Evaluate the model to calculate krel. - AmanziMesh::Entity_ID_List cells; int nbfaces = res_bf.MyLength(); for (unsigned int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*wrms_->first)[cells[0]]; @@ -221,14 +220,14 @@ RelPermSutraIceEvaluator::Evaluate_(const State& S, const std::vector surf_mesh = S.GetMesh(surf_domain_); Teuchos::RCP mesh = result[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); unsigned int nsurf_cells = - surf_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + surf_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int sc = 0; sc != nsurf_cells; ++sc) { // need to map from surface quantity on cells to subsurface boundary_face quantity - AmanziMesh::Entity_ID f = surf_mesh->entity_get_parent(AmanziMesh::CELL, sc); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); AmanziMesh::Entity_ID bf = vandelay_map.LID(face_map.GID(f)); res_bf[0][bf] = std::max(surf_kr[0][sc], min_val_); diff --git a/src/pks/flow/constitutive_relations/wrm/wrm_evaluator.cc b/src/pks/flow/constitutive_relations/wrm/wrm_evaluator.cc index d402dc106..516d230ef 100644 --- a/src/pks/flow/constitutive_relations/wrm/wrm_evaluator.cc +++ b/src/pks/flow/constitutive_relations/wrm/wrm_evaluator.cc @@ -108,16 +108,15 @@ WRMEvaluator::Evaluate_(const State& S, const std::vector& res // Need to get boundary face's inner cell to specify the WRM. Teuchos::RCP mesh = results[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); // calculate boundary face values int nbfaces = sat_bf.MyLength(); for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*wrms_->first)[cells[0]]; @@ -178,16 +177,15 @@ WRMEvaluator::EvaluatePartialDerivative_(const State& S, // Need to get boundary face's inner cell to specify the WRM. Teuchos::RCP mesh = results[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); // calculate boundary face values int nbfaces = sat_bf.MyLength(); for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int index = (*wrms_->first)[cells[0]]; diff --git a/src/pks/flow/constitutive_relations/wrm/wrm_permafrost_evaluator.cc b/src/pks/flow/constitutive_relations/wrm/wrm_permafrost_evaluator.cc index 19ea2ceab..f7b15e088 100644 --- a/src/pks/flow/constitutive_relations/wrm/wrm_permafrost_evaluator.cc +++ b/src/pks/flow/constitutive_relations/wrm/wrm_permafrost_evaluator.cc @@ -179,16 +179,15 @@ WRMPermafrostEvaluator::Evaluate_(const State& S, const std::vector mesh = results[0]->Mesh(); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - const Epetra_Map& face_map = mesh->face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); // calculate boundary face values int nbfaces = satg_bf.MyLength(); for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int i = (*permafrost_models_->first)[cells[0]]; @@ -262,9 +261,8 @@ WRMPermafrostEvaluator::EvaluatePartialDerivative_(const State& S, // Need to get boundary face's inner cell to specify the WRM. Teuchos::RCP mesh = results[0]->Mesh(); - const Epetra_Map& face_map = mesh->face_map(false); - const Epetra_Map& vandelay_map = mesh->exterior_face_map(false); - AmanziMesh::Entity_ID_List cells; + const Epetra_Map& face_map = mesh->getMap(AmanziMesh::Entity_kind::FACE,false); + const Epetra_Map& vandelay_map = mesh->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); if (wrt_key == pc_liq_key_) { // calculate boundary face values @@ -272,7 +270,7 @@ WRMPermafrostEvaluator::EvaluatePartialDerivative_(const State& S, for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int i = (*permafrost_models_->first)[cells[0]]; @@ -289,7 +287,7 @@ WRMPermafrostEvaluator::EvaluatePartialDerivative_(const State& S, for (int bf = 0; bf != nbfaces; ++bf) { // given a boundary face, we need the internal cell to choose the right WRM AmanziMesh::Entity_ID f = face_map.LID(vandelay_map.GID(bf)); - mesh->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int i = (*permafrost_models_->first)[cells[0]]; diff --git a/src/pks/flow/overland_pressure_physics.cc b/src/pks/flow/overland_pressure_physics.cc index 6b52b0264..3cc929306 100644 --- a/src/pks/flow/overland_pressure_physics.cc +++ b/src/pks/flow/overland_pressure_physics.cc @@ -21,7 +21,7 @@ OverlandPressureFlow::ApplyDiffusion_(const Tag& tag, const Teuchos::Ptrnum_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); // update the rel perm according to the scheme of choice. UpdatePermeabilityData_(tag); diff --git a/src/pks/flow/overland_pressure_pk.cc b/src/pks/flow/overland_pressure_pk.cc index 34aa8c257..2937ff634 100644 --- a/src/pks/flow/overland_pressure_pk.cc +++ b/src/pks/flow/overland_pressure_pk.cc @@ -121,7 +121,7 @@ OverlandPressureFlow::Setup() requireAtNext(conserved_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // and at the current time, where it is a copy evaluator requireAtCurrent(conserved_key_, tag_current_, *S_, name_); @@ -130,7 +130,7 @@ OverlandPressureFlow::Setup() requireAtNext(molar_dens_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); SetupOverlandFlow_(); SetupPhysicalEvaluators_(); @@ -179,7 +179,7 @@ OverlandPressureFlow::SetupOverlandFlow_() S_->Require(flux_dir_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); // -- nonlinear coefficients and upwinding Teuchos::ParameterList& upwind_plist = plist_->sublist("upwinding"); @@ -191,12 +191,12 @@ OverlandPressureFlow::SetupOverlandFlow_() S_->Require(uw_cond_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } else if (coef_location == "standard: cell") { S_->Require(uw_cond_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { Errors::Message message; message << name_ << ": Unknown upwind coefficient location in overland flow."; @@ -276,7 +276,7 @@ OverlandPressureFlow::SetupOverlandFlow_() S_->Require(duw_cond_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); upwinding_dkdp_ = Teuchos::rcp(new Operators::UpwindTotalFlux(name_, tag_next_, flux_dir_key_, 1.e-12)); @@ -298,7 +298,7 @@ OverlandPressureFlow::SetupOverlandFlow_() S_->RequireEvaluator(ss_flux_key_, tag_next_); S_->Require(ss_flux_key_, tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } // accumulation @@ -311,28 +311,28 @@ OverlandPressureFlow::SetupOverlandFlow_() S_->Require(key_, tag_next_, name_) .Update(matrix_->RangeMap()) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); // NOTE: no need to require evaluator for p here, this was done in pk_physical // potential may not actually need cells, but for debugging and sanity's sake, we require them requireAtNext(potential_key_, tag_next_, *S_) .Update(matrix_->RangeMap()) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); // flux requireAtNext(flux_key_, tag_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); // velocity for diagnostics requireAtNext(velocity_key_, Tags::NEXT, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 3); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 3); }; @@ -352,7 +352,7 @@ OverlandPressureFlow::SetupPhysicalEvaluators_() requireAtNext(source_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); if (source_in_meters_) { // density of incoming water [mol/m^3] @@ -360,7 +360,7 @@ OverlandPressureFlow::SetupPhysicalEvaluators_() Keys::readKey(*plist_, domain_, "source molar density", "source_molar_density"); requireAtNext(source_molar_dens_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } @@ -368,7 +368,7 @@ OverlandPressureFlow::SetupPhysicalEvaluators_() requireAtNext(wc_bar_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireDerivative( wc_bar_key_, tag_next_, key_, tag_next_); @@ -382,7 +382,7 @@ OverlandPressureFlow::SetupPhysicalEvaluators_() requireAtNext(pd_bar_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireDerivative( pd_bar_key_, tag_next_, key_, tag_next_); @@ -390,8 +390,8 @@ OverlandPressureFlow::SetupPhysicalEvaluators_() requireAtNext(cond_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); } @@ -431,13 +431,13 @@ OverlandPressureFlow::Initialize() // copy subsurface face pressure to surface cell pressure Teuchos::RCP subsurf_pres = S_->GetPtr(key_ss, tag_next_); - auto ncells_surface = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + auto ncells_surface = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (subsurf_pres->HasComponent("face")) { const Epetra_MultiVector& subsurf_pres_f = *S_->GetPtr(key_ss, tag_next_)->ViewComponent("face", false); for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face and neighboring cell - AmanziMesh::Entity_ID f = mesh_->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); pres[0][c] = subsurf_pres_f[0][f]; } @@ -448,8 +448,8 @@ OverlandPressureFlow::Initialize() for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face and neighboring cell - AmanziMesh::Entity_ID f = mesh_->entity_get_parent(AmanziMesh::CELL, c); - int bf = mesh_domain->exterior_face_map(false).LID(mesh_domain->face_map(false).GID(f)); + AmanziMesh::Entity_ID f = mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); + int bf = mesh_domain->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false).LID(mesh_domain->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f)); if (bf >= 0) pres[0][c] = subsurf_pres_bf[0][bf]; } } @@ -463,9 +463,9 @@ OverlandPressureFlow::Initialize() Epetra_MultiVector& pres_star = *pres_cv->ViewComponent("cell", false); unsigned int ncells_surface = - mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (unsigned int c = 0; c != ncells_surface; ++c) { - int id = mesh_->cell_map(false).GID(c); + int id = mesh_->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c); Key domain_sf = Keys::getDomainInSet(surf_dset_name, id); const Epetra_MultiVector& pres = @@ -564,17 +564,16 @@ OverlandPressureFlow::CalculateDiagnostics(const Tag& tag) const Epetra_MultiVector& pd_c = *S_->GetPtr(pd_key_, tag_next_)->ViewComponent("cell"); - int d(mesh_->space_dimension()); + int d(mesh_->getSpaceDimension()); AmanziGeometry::Point local_velocity(d); Teuchos::LAPACK lapack; Teuchos::SerialDenseMatrix matrix(d, d); double rhs[d]; - int ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); - AmanziMesh::Entity_ID_List faces; + int ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int c = 0; c != ncells_owned; ++c) { - mesh_->cell_get_faces(c, &faces); + auto faces = mesh_->getCellFaces(c); int nfaces = faces.size(); for (int i = 0; i != d; ++i) rhs[i] = 0.0; @@ -582,8 +581,8 @@ OverlandPressureFlow::CalculateDiagnostics(const Tag& tag) for (int n = 0; n != nfaces; ++n) { // populate least-square matrix int f = faces[n]; - const AmanziGeometry::Point& normal = mesh_->face_normal(f); - double area = mesh_->face_area(f); + const AmanziGeometry::Point& normal = mesh_->getFaceNormal(f); + double area = mesh_->getFaceArea(f); for (int i = 0; i != d; ++i) { rhs[i] += normal[i] * flux_f[0][f]; @@ -656,7 +655,7 @@ OverlandPressureFlow::UpdatePermeabilityData_(const Tag& tag) // -- Move rel perm on boundary_faces into uw_rel_perm on faces { - const Epetra_Import& vandelay = mesh_->exterior_face_importer(); + const Epetra_Import& vandelay = mesh_->getBoundaryFaceImporter(); const Epetra_MultiVector& cond_bf = *cond->ViewComponent("boundary_face", false); Epetra_MultiVector& uw_cond_f = *uw_cond->ViewComponent("face", false); uw_cond_f.Export(cond_bf, vandelay, Insert); @@ -777,8 +776,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) for (const auto& bc : *bc_pressure_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; double p0 = bc.second > p_atm ? bc.second : p_atm; @@ -793,8 +791,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) // non-thermal model for (const auto& bc : *bc_pressure_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; double p0 = bc.second > p_atm ? bc.second : p_atm; @@ -851,8 +848,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) bc_lvl != bc_level_flux_lvl_->end(); ++bc_lvl, ++bc_vel) { int f = bc_lvl->first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; markers[f] = Operators::OPERATOR_BC_NEUMANN; @@ -876,8 +872,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) double gz = -(S_->Get("gravity", Tags::DEFAULT))[2]; for (const auto& bc : *bc_critical_depth_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; markers[f] = Operators::OPERATOR_BC_NEUMANN; @@ -900,8 +895,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) for (const auto& bc : *bc_seepage_head_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; double hz_f = bc.second + elevation[0][f]; @@ -941,8 +935,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) for (const auto& bc : *bc_seepage_pressure_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; double p0 = bc.second > p_atm ? bc.second : p_atm; @@ -963,8 +956,7 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) // non-thermal model for (const auto& bc : *bc_seepage_pressure_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int c = cells[0]; double p0 = bc.second > p_atm ? bc.second : p_atm; @@ -994,19 +986,17 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) Teuchos::RCP flux = S_->GetPtr(flux_key_, tag); const Epetra_MultiVector& flux_f = *flux->ViewComponent("face", false); - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (const auto& bc : *bc_tidal_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells, faces; - std::vector fdirs; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); AmanziMesh::Entity_ID c = cells[0]; if (f < nfaces_owned) { - mesh_->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh_->getCellFacesAndDirections(c); int j = 0; for (j = 0; j < faces.size(); j++) { if (faces[j] == f) break; @@ -1036,15 +1026,14 @@ OverlandPressureFlow::UpdateBoundaryConditions_(const Tag& tag) // check that there are no internal faces and mark all remaining boundary // conditions as the default, zero flux conditions - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (int f = 0; f != nfaces_owned; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int ncells = cells.size(); if ((markers[f] != Operators::OPERATOR_BC_NONE) && (ncells == 2)) { Errors::Message msg("Tried to set a boundary condition on internal face GID "); - msg << mesh_->face_map(false).GID(f); + msg << mesh_->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f); Exceptions::amanzi_throw(msg); } if ((markers[f] == Operators::OPERATOR_BC_NONE) && (ncells == 1)) { @@ -1078,8 +1067,8 @@ OverlandPressureFlow::ApplyBoundaryConditions_(const Teuchos::PtrHasComponent("boundary_face")) { const Epetra_MultiVector& elevation = *elev->ViewComponent("face"); - const Epetra_Map& vandalay_map = mesh_->exterior_face_map(false); - const Epetra_Map& face_map = mesh_->face_map(false); + const Epetra_Map& vandalay_map = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh_->getMap(AmanziMesh::Entity_kind::FACE,false); const Epetra_MultiVector& u_c = *u->ViewComponent("cell", false); Epetra_MultiVector& u_bf = *u->ViewComponent("boundary_face", false); @@ -1093,8 +1082,7 @@ OverlandPressureFlow::ApplyBoundaryConditions_(const Teuchos::Ptrface_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); u_bf[0][bf] = u_c[0][cells[0]]; } } @@ -1132,13 +1120,12 @@ OverlandPressureFlow::FixBCsForOperator_(const Tag& tag, std::vector& Aff = diff_op->local_op()->matrices; - int ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (const auto& bc : *bc_zero_gradient_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); AmanziMesh::Entity_ID c = cells[0]; @@ -1147,7 +1134,7 @@ OverlandPressureFlow::FixBCsForOperator_(const Tag& tag, double bc_val = -dp * Aff[f](0, 0); markers[f] = Operators::OPERATOR_BC_NEUMANN; - values[f] = bc_val / mesh_->face_area(f); + values[f] = bc_val / mesh_->getFaceArea(f); } } } @@ -1163,19 +1150,17 @@ OverlandPressureFlow::FixBCsForOperator_(const Tag& tag, std::vector& Aff = diff_op->local_op()->matrices; double gz = -(S_->Get("gravity", Tags::DEFAULT))[2]; - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (const auto& bc : *bc_tidal_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells, faces; - std::vector fdirs; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); AmanziMesh::Entity_ID c = cells[0]; if (f < nfaces_owned) { - mesh_->cell_get_faces_and_dirs(c, &faces, &fdirs); + const auto& [faces, fdirs] = mesh_->getCellFacesAndDirections(c); int j = 0; for (j = 0; j < faces.size(); j++) { if (faces[j] == f) break; @@ -1192,7 +1177,7 @@ OverlandPressureFlow::FixBCsForOperator_(const Tag& tag, double bc_val = -dp * Aff[f](0, 0); markers[f] = Operators::OPERATOR_BC_NEUMANN; - values[f] = bc_val / mesh_->face_area(f); + values[f] = bc_val / mesh_->getFaceArea(f); } else { markers[f] = Operators::OPERATOR_BC_DIRICHLET; values[f] = h0; @@ -1275,7 +1260,7 @@ OverlandPressureFlow::ModifyCorrection(double h, my_limited++; } } - mesh_->get_comm()->MaxAll(&my_limited, &n_limited_spurt, 1); + mesh_->getComm()->MaxAll(&my_limited, &n_limited_spurt, 1); } if (patm_hard_limit_) { @@ -1290,7 +1275,7 @@ OverlandPressureFlow::ModifyCorrection(double h, my_limited++; } } - mesh_->get_comm()->MaxAll(&my_limited, &n_limited_spurt, 1); + mesh_->getComm()->MaxAll(&my_limited, &n_limited_spurt, 1); } if (n_limited_spurt > 0) { @@ -1333,7 +1318,7 @@ OverlandPressureFlow::ModifyCorrection(double h, } } - mesh_->get_comm()->SumAll(&my_limited, &n_limited_change, 1); + mesh_->getComm()->SumAll(&my_limited, &n_limited_change, 1); } if (n_limited_change > 0) { diff --git a/src/pks/flow/predictor_delegate_bc_flux.cc b/src/pks/flow/predictor_delegate_bc_flux.cc index 708855dcb..9cacd0fb2 100644 --- a/src/pks/flow/predictor_delegate_bc_flux.cc +++ b/src/pks/flow/predictor_delegate_bc_flux.cc @@ -47,15 +47,12 @@ Teuchos::RCP PredictorDelegateBCFlux::CreateFunctor_(int f, const Teuchos::Ptr& pres) { // inner cell and its water retention model - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int c = cells[0]; // that cell's faces - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh_->cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh_->getCellFacesAndDirections(c); // index within that cell's faces unsigned int n = std::find(faces.begin(), faces.end(), f) - faces.begin(); @@ -84,7 +81,7 @@ PredictorDelegateBCFlux::CreateFunctor_(int f, const Teuchos::Ptrface_area(f) * (*bc_values_)[f]; + double bc_flux = mesh_->getFaceArea(f) * (*bc_values_)[f]; double gflux = rhs_f[0][faces[n]] / Krel; #if DEBUG_FLAG @@ -178,7 +175,7 @@ PredictorDelegateBCFlux::CalculateLambdaToms_(int f, std::cout << " Converged to " << lambda << " in " << actual_it << " steps." << std::endl; AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int c = cells[0]; diff --git a/src/pks/flow/preferential_pk.cc b/src/pks/flow/preferential_pk.cc index 9bbe2ab49..5f05e196a 100644 --- a/src/pks/flow/preferential_pk.cc +++ b/src/pks/flow/preferential_pk.cc @@ -83,12 +83,12 @@ Preferential::RequireNonlinearCoefficient_(const Key& key, const std::string& co S_->Require(key, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponents({ "face", "grav" }, { AmanziMesh::FACE, AmanziMesh::FACE }, { 1, 1 }); + ->SetComponents({ "face", "grav" }, { AmanziMesh::Entity_kind::FACE, AmanziMesh::Entity_kind::FACE }, { 1, 1 }); } else if (coef_location == "standard: cell") { S_->Require(key, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponents({ "cell", "grav" }, { AmanziMesh::CELL, AmanziMesh::FACE }, { 1, 1 }); + ->SetComponents({ "cell", "grav" }, { AmanziMesh::Entity_kind::CELL, AmanziMesh::Entity_kind::FACE }, { 1, 1 }); } else { Errors::Message message("Unknown upwind coefficient location in Preferential flow."); Exceptions::amanzi_throw(message); @@ -110,8 +110,8 @@ Preferential::SetupPhysicalEvaluators_() requireAtNext(coef_grav_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); } @@ -162,13 +162,10 @@ Preferential::UpdatePermeabilityData_(const Tag& tag) for (int f = 0; f != markers.size(); ++f) { if (markers[f] == Operators::OPERATOR_BC_NEUMANN) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int c = cells[0]; - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh_->cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh_->getCellFacesAndDirections(c); int i = std::find(faces.begin(), faces.end(), f) - faces.begin(); flux_dir_f[0][f] = values[f] * dirs[i]; @@ -185,7 +182,7 @@ Preferential::UpdatePermeabilityData_(const Tag& tag) S_->GetPtrW(uw_coef_key_, tag, name_); // // Move rel perm on boundary_faces into uw_rel_perm on faces - const Epetra_Import& vandelay = mesh_->exterior_face_importer(); + const Epetra_Import& vandelay = mesh_->getBoundaryFaceImporter(); const Epetra_MultiVector& rel_perm_bf = *rel_perm->ViewComponent("boundary_face", false); const Epetra_MultiVector& rel_perm_grav_bf = *rel_perm_grav->ViewComponent("boundary_face", false); @@ -204,8 +201,8 @@ Preferential::UpdatePermeabilityData_(const Tag& tag) uw_rel_perm_f.Export(rel_perm_bf, vandelay, Insert); } else if (clobber_policy_ == "max") { Epetra_MultiVector& uw_rel_perm_f = *uw_rel_perm->ViewComponent("face", false); - const auto& fmap = mesh_->face_map(true); - const auto& bfmap = mesh_->exterior_face_map(true); + const auto& fmap = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); + const auto& bfmap = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,true); for (int bf = 0; bf != rel_perm_bf.MyLength(); ++bf) { auto f = fmap.LID(bfmap.GID(bf)); if (rel_perm_bf[0][bf] > uw_rel_perm_f[0][f]) { uw_rel_perm_f[0][f] = rel_perm_bf[0][bf]; } @@ -215,12 +212,11 @@ Preferential::UpdatePermeabilityData_(const Tag& tag) Epetra_MultiVector& uw_rel_perm_f = *uw_rel_perm->ViewComponent("face", false); const Epetra_MultiVector& pres = *S_->Get(key_, tag).ViewComponent("cell", false); - const auto& fmap = mesh_->face_map(true); - const auto& bfmap = mesh_->exterior_face_map(true); + const auto& fmap = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); + const auto& bfmap = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,true); for (int bf = 0; bf != rel_perm_bf.MyLength(); ++bf) { auto f = fmap.LID(bfmap.GID(bf)); - AmanziMesh::Entity_ID_List fcells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + auto fcells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() == 1); if (pres[0][fcells[0]] < 101225.) { uw_rel_perm_f[0][f] = rel_perm_bf[0][bf]; diff --git a/src/pks/flow/richards_physics.cc b/src/pks/flow/richards_physics.cc index fd3987cab..9697e6be9 100644 --- a/src/pks/flow/richards_physics.cc +++ b/src/pks/flow/richards_physics.cc @@ -140,7 +140,7 @@ Richards::SetAbsolutePermeabilityTensor_(const Tag& tag) *S_->Get(perm_key_, tag).ViewComponent("cell", false); unsigned int ncells = perm.MyLength(); unsigned int ndofs = perm.NumVectors(); - int space_dim = mesh_->space_dimension(); + int space_dim = mesh_->getSpaceDimension(); if (ndofs == 1) { // isotropic for (unsigned int c = 0; c != ncells; ++c) { (*K_)[c](0, 0) = perm[0][c] * perm_scale_; } } else if (ndofs == 2 && space_dim == 3) { @@ -192,17 +192,16 @@ Richards::UpdateVelocity_(const Tag& tag) Epetra_MultiVector& velocity = *S_->GetW(velocity_key_, tag, name_).ViewComponent("cell", true); - int d(mesh_->space_dimension()); + int d(mesh_->getSpaceDimension()); AmanziGeometry::Point local_velocity(d); Teuchos::LAPACK lapack; Teuchos::SerialDenseMatrix matrix(d, d); double rhs[d]; - int ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); - AmanziMesh::Entity_ID_List faces; + int ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int c = 0; c != ncells_owned; ++c) { - mesh_->cell_get_faces(c, &faces); + auto faces = mesh_->getCellFaces(c); int nfaces = faces.size(); for (int i = 0; i != d; ++i) rhs[i] = 0.0; @@ -210,8 +209,8 @@ Richards::UpdateVelocity_(const Tag& tag) for (int n = 0; n != nfaces; ++n) { // populate least-square matrix int f = faces[n]; - const AmanziGeometry::Point& normal = mesh_->face_normal(f); - double area = mesh_->face_area(f); + const AmanziGeometry::Point& normal = mesh_->getFaceNormal(f); + double area = mesh_->getFaceArea(f); for (int i = 0; i != d; ++i) { rhs[i] += normal[i] * flux[0][f]; diff --git a/src/pks/flow/richards_pk.cc b/src/pks/flow/richards_pk.cc index 3cd92ba8c..5ab0c1190 100644 --- a/src/pks/flow/richards_pk.cc +++ b/src/pks/flow/richards_pk.cc @@ -127,7 +127,7 @@ Richards::SetupRichardsFlow_() // Get data for special-case entities. S_->Require(cell_vol_key_, tag_next_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator(cell_vol_key_, tag_next_); // Set up Operators @@ -157,10 +157,10 @@ Richards::SetupRichardsFlow_() num_perm_vals_ = 2; } else if (perm_type == "diagonal tensor") { perm_tensor_rank_ = 2; - num_perm_vals_ = mesh_->space_dimension(); + num_perm_vals_ = mesh_->getSpaceDimension(); } else if (perm_type == "full tensor") { perm_tensor_rank_ = 2; - num_perm_vals_ = (mesh_->space_dimension() == 3) ? 6 : 3; + num_perm_vals_ = (mesh_->getSpaceDimension() == 3) ? 6 : 3; } else { Errors::Message message( "`permeability type` must be one of the following: \"scalar\", \"diagonal tensor\", \"full " @@ -172,10 +172,10 @@ Richards::SetupRichardsFlow_() if (!deform_key_.empty()) S_->RequireEvaluator(deform_key_, tag_next_); // data allocation -- move to State! - unsigned int c_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + unsigned int c_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); K_ = Teuchos::rcp(new std::vector(c_owned)); for (unsigned int c = 0; c != c_owned; ++c) { - (*K_)[c].Init(mesh_->space_dimension(), perm_tensor_rank_); + (*K_)[c].Init(mesh_->getSpaceDimension(), perm_tensor_rank_); } // -- nonlinear coefficients/upwinding @@ -239,7 +239,7 @@ Richards::SetupRichardsFlow_() S_->Require(flux_dir_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); // -- create the operators for the preconditioner // diffusion @@ -319,11 +319,11 @@ Richards::SetupRichardsFlow_() // // Create the vapor diffusion vectors // S_->Require("vapor_diffusion_pressure", tag_next_, name_).SetMesh(mesh_)->SetGhosted() - // ->SetComponent("cell", AmanziMesh::CELL, 1); + // ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // S_->GetRecordW("vapor_diffusion_pressure",name_)->set_io_vis(true); // S_->Require("vapor_diffusion_temperature", tag_next_, name_).SetMesh(mesh_)->SetGhosted() - // ->SetComponent("cell", AmanziMesh::CELL, 1); + // ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // S_->GetRecordW("vapor_diffusion_temperature",name_)->set_io_vis(true); // // operator for the vapor diffusion terms @@ -340,7 +340,7 @@ Richards::SetupRichardsFlow_() requireAtNext(source_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); if (source_term_is_differentiable_) { // require derivative of source S_->RequireDerivative( @@ -357,7 +357,7 @@ Richards::SetupRichardsFlow_() Keys::readKey(*plist_, domain_surf, "surface-subsurface flux", "surface_subsurface_flux"); S_->Require(ss_flux_key_, tag_next_) .SetMesh(S_->GetMesh(domain_surf)) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } // -- coupling done by a Dirichlet condition @@ -384,7 +384,7 @@ Richards::SetupRichardsFlow_() CompositeVectorSpace matrix_cvs = matrix_->RangeMap(); compute_boundary_values_ = plist_->get("compute boundary values", false); if (compute_boundary_values_) - matrix_cvs.AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + matrix_cvs.AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); S_->Require(key_, tag_next_, name_) .Update(matrix_cvs) ->SetGhosted(); @@ -393,14 +393,14 @@ Richards::SetupRichardsFlow_() requireAtNext(flux_key_, tag_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); // -- also need a velocity, but only for vis/diagnostics, so might as well // -- only keep at NEXT requireAtNext(velocity_key_, Tags::NEXT, *S_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 3); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 3); // Globalization and other timestep control flags // -- predictors @@ -433,13 +433,13 @@ Richards::SetupPhysicalEvaluators_() requireAtNext(perm_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, num_perm_vals_); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, num_perm_vals_); // -- water content, and evaluator, and derivative for PC requireAtNext(conserved_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireDerivative( conserved_key_, tag_next_, key_, tag_next_); @@ -451,11 +451,11 @@ Richards::SetupPhysicalEvaluators_() requireAtNext(sat_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(sat_gas_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); auto& wrm = S_->RequireEvaluator(sat_key_, tag_next_); // and at the current time, where it is a copy evaluator @@ -465,8 +465,8 @@ Richards::SetupPhysicalEvaluators_() requireAtNext(coef_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1) - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1) + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1); // -- get the WRM models auto wrm_eval = dynamic_cast(&wrm); @@ -477,13 +477,13 @@ Richards::SetupPhysicalEvaluators_() requireAtNext(molar_dens_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // -- liquid mass density for the gravity fluxes requireAtNext(mass_dens_key_, tag_next_, *S_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } @@ -497,12 +497,12 @@ Richards::RequireNonlinearCoefficient_(const Key& key, const std::string& coef_l S_->Require(key, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } else if (coef_location == "standard: cell") { S_->Require(key, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { Errors::Message message("Unknown upwind coefficient location in Richards flow."); Exceptions::amanzi_throw(message); @@ -577,10 +577,10 @@ Richards::InitializeHydrostatic_(const Tag& tag) double head_wt = plist_->sublist("initial condition").get("hydrostatic head [m]"); double rho = plist_->sublist("initial condition").get("hydrostatic water density [kg m^-3]"); - int ncols = mesh_->num_columns(false); + int ncols = mesh_->columns.num_columns_owned; const auto& gvec = S_->Get("gravity", Tags::DEFAULT); - int z_index = mesh_->space_dimension() - 1; + int z_index = mesh_->getSpaceDimension() - 1; double g = -gvec[z_index]; double p_atm = S_->Get("atmospheric_pressure", Tags::DEFAULT); @@ -597,12 +597,12 @@ Richards::InitializeHydrostatic_(const Tag& tag) int ncells_per = -1; for (int col = 0; col != ncols; ++col) { - auto& col_cells = mesh_->cells_of_column(col); + auto col_cells = mesh_->columns.getCells(col); if (ncells_per < 0) ncells_per = col_cells.size(); AMANZI_ASSERT(col_cells.size() == ncells_per); - auto& col_faces = mesh_->faces_of_column(col); + auto col_faces = mesh_->columns.getFaces(col); AMANZI_ASSERT(col_faces.size() == col_cells.size() + 1); - double z_wt = mesh_->face_centroid(col_faces[0])[z_index] + head_wt; + double z_wt = mesh_->getFaceCentroid(col_faces[0])[z_index] + head_wt; if (pres_f.get()) { (*pres_f)[0][col_faces[0]] = p_atm + rho * g * head_wt; @@ -611,9 +611,9 @@ Richards::InitializeHydrostatic_(const Tag& tag) for (int lcv_c = 0; lcv_c != col_cells.size(); ++lcv_c) { AmanziMesh::Entity_ID c = col_cells[lcv_c]; AmanziMesh::Entity_ID f = col_faces[lcv_c + 1]; - pres_c[0][c] = p_atm + rho * g * (z_wt - mesh_->cell_centroid(c)[z_index]); + pres_c[0][c] = p_atm + rho * g * (z_wt - mesh_->getCellCentroid(c)[z_index]); if (pres_f.get()) { - (*pres_f)[0][f] = p_atm + rho * g * (z_wt - mesh_->face_centroid(f)[z_index]); + (*pres_f)[0][f] = p_atm + rho * g * (z_wt - mesh_->getFaceCentroid(f)[z_index]); (*flags)[f] = 1; } } @@ -628,8 +628,7 @@ Richards::InitializeHydrostatic_(const Tag& tag) Epetra_MultiVector& pres_f = *pres->ViewComponent("face", false); for (AmanziMesh::Entity_ID f = 0; f != pres_f.MyLength(); ++f) { if (!(*flags)[f]) { - AmanziMesh::Entity_ID_List f_cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &f_cells); + auto f_cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); if (f_cells.size() == 1) { // boundary face, use the cell value as the water table is // assumed to parallel the cell structure @@ -654,7 +653,7 @@ Richards::InitializeHydrostatic_(const Tag& tag) double rho = plist_->sublist("initial condition").get("hydrostatic water density [kg m^-3]"); - int z_index = mesh_->space_dimension() - 1; + int z_index = mesh_->getSpaceDimension() - 1; const auto& gravity = S_->Get("gravity", Tags::DEFAULT); double g = -gravity[z_index]; @@ -663,13 +662,13 @@ Richards::InitializeHydrostatic_(const Tag& tag) Teuchos::RCP pres = S_->GetPtrW(key_, tag, name()); Epetra_MultiVector& pres_c = *pres->ViewComponent("cell", false); for (int c = 0; c != pres_c.MyLength(); ++c) { - pres_c[0][c] = p_atm + rho * g * (z_wt - mesh_->cell_centroid(c)[z_index]); + pres_c[0][c] = p_atm + rho * g * (z_wt - mesh_->getCellCentroid(c)[z_index]); } if (pres->HasComponent("face")) { Epetra_MultiVector& pres_f = *pres->ViewComponent("face", false); for (int f = 0; f != pres_f.MyLength(); ++f) { - pres_f[0][f] = p_atm + rho * g * (z_wt - mesh_->face_centroid(f)[z_index]); + pres_f[0][f] = p_atm + rho * g * (z_wt - mesh_->getFaceCentroid(f)[z_index]); } } S_->GetRecordW(key_, tag, name()).set_initialized(); @@ -821,13 +820,10 @@ Richards::UpdatePermeabilityData_(const Tag& tag) for (int f = 0; f != markers.size(); ++f) { if (markers[f] == Operators::OPERATOR_BC_NEUMANN) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); int c = cells[0]; - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh_->cell_get_faces_and_dirs(c, &faces, &dirs); + auto [faces, dirs] = mesh_->getCellFacesAndDirections(c); int i = std::find(faces.begin(), faces.end(), f) - faces.begin(); flux_dir_f[0][f] = values[f] * dirs[i]; @@ -844,7 +840,7 @@ Richards::UpdatePermeabilityData_(const Tag& tag) S_->GetPtrW(uw_coef_key_, tag, name_); // Move rel perm on boundary_faces into uw_rel_perm on faces - const Epetra_Import& vandelay = mesh_->exterior_face_importer(); + const Epetra_Import& vandelay = mesh_->getBoundaryFaceImporter(); const Epetra_MultiVector& rel_perm_bf = *rel_perm->ViewComponent("boundary_face", false); { Epetra_MultiVector& uw_rel_perm_f = *uw_rel_perm->ViewComponent("face", false); @@ -859,8 +855,8 @@ Richards::UpdatePermeabilityData_(const Tag& tag) uw_rel_perm_f.Export(rel_perm_bf, vandelay, Insert); } else if (clobber_policy_ == "max") { Epetra_MultiVector& uw_rel_perm_f = *uw_rel_perm->ViewComponent("face", false); - const auto& fmap = mesh_->face_map(true); - const auto& bfmap = mesh_->exterior_face_map(true); + const auto& fmap = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); + const auto& bfmap = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,true); for (int bf = 0; bf != rel_perm_bf.MyLength(); ++bf) { auto f = fmap.LID(bfmap.GID(bf)); if (rel_perm_bf[0][bf] > uw_rel_perm_f[0][f]) { uw_rel_perm_f[0][f] = rel_perm_bf[0][bf]; } @@ -870,12 +866,11 @@ Richards::UpdatePermeabilityData_(const Tag& tag) Epetra_MultiVector& uw_rel_perm_f = *uw_rel_perm->ViewComponent("face", false); const Epetra_MultiVector& pres = *S_->Get(key_, tag).ViewComponent("cell", false); - const auto& fmap = mesh_->face_map(true); - const auto& bfmap = mesh_->exterior_face_map(true); + const auto& fmap = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); + const auto& bfmap = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,true); for (int bf = 0; bf != rel_perm_bf.MyLength(); ++bf) { auto f = fmap.LID(bfmap.GID(bf)); - AmanziMesh::Entity_ID_List fcells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + auto fcells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() == 1); if (pres[0][fcells[0]] < 101225.) { uw_rel_perm_f[0][f] = rel_perm_bf[0][bf]; @@ -966,8 +961,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (const auto& bc : *bc_pressure_) { int f = bc.first; #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif markers[f] = Operators::OPERATOR_BC_DIRICHLET; @@ -978,29 +972,31 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) bc_counts.push_back(bc_head_->size()); bc_names.push_back("head"); if (bc_head_->size() > 0) { + Errors::Message mesg("column_ID not implemented in Amanzi"); + Exceptions::amanzi_throw(mesg); + double p_atm = S_->Get("atmospheric_pressure", Tags::DEFAULT); - int z_index = mesh_->space_dimension() - 1; + int z_index = mesh_->getSpaceDimension() - 1; const auto& gravity = S_->Get("gravity", Tags::DEFAULT); double g = -gravity[z_index]; for (const auto& bc : *bc_head_) { int f = bc.first; - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); // we need to find the elevation of the surface, but finding the top edge // of this stack of faces is not possible currently. The best approach // is instead to work with the cell. - int col = mesh_->column_ID(cells[0]); - double z_surf = mesh_->face_centroid(mesh_->faces_of_column(col)[0])[z_index]; + int col = 0; // mesh_->column_ID(cells[0]); + double z_surf = mesh_->getFaceCentroid(mesh_->columns.getFaces(col)[0])[z_index]; double z_wt = bc.second + z_surf; markers[f] = Operators::OPERATOR_BC_DIRICHLET; // note, here the cell centroid's z is used to relate to the column's top // face centroid, specifically NOT the boundary face's centroid. - values[f] = p_atm + bc_rho_water_ * g * (z_wt - mesh_->cell_centroid(cells[0])[z_index]); + values[f] = p_atm + bc_rho_water_ * g * (z_wt - mesh_->getCellCentroid(cells[0])[z_index]); } } @@ -1009,14 +1005,14 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) bc_names.push_back("head"); if (bc_level_->size() > 0) { double p_atm = S_->Get("atmospheric_pressure", Tags::DEFAULT); - int z_index = mesh_->space_dimension() - 1; + int z_index = mesh_->getSpaceDimension() - 1; const auto& gravity = S_->Get("gravity", Tags::DEFAULT); double g = -gravity[z_index]; for (const auto& bc : *bc_level_) { int f = bc.first; markers[f] = Operators::OPERATOR_BC_DIRICHLET; - values[f] = p_atm + bc_rho_water_ * g * (bc.second - mesh_->face_centroid(f)[z_index]); + values[f] = p_atm + bc_rho_water_ * g * (bc.second - mesh_->getFaceCentroid(f)[z_index]); } } @@ -1033,8 +1029,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (const auto& bc : *bc_flux_) { int f = bc.first; #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif markers[f] = Operators::OPERATOR_BC_NEUMANN; @@ -1050,8 +1045,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (const auto& bc : *bc_flux_) { int f = bc.first; #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif markers[f] = Operators::OPERATOR_BC_NEUMANN; @@ -1078,8 +1072,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (const auto& bc : *bc_seepage_) { int f = bc.first; #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif @@ -1120,8 +1113,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (const auto& bc : *bc_seepage_infilt_) { int f = bc.first; #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif @@ -1193,10 +1185,9 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face - AmanziMesh::Entity_ID f = surface->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surface->getEntityParent(AmanziMesh::Entity_kind::CELL, c); #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif // -- set that value to dirichlet @@ -1217,10 +1208,9 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) bc_counts[bc_counts.size() - 1] = ncells_surface; for (unsigned int c = 0; c != ncells_surface; ++c) { // -- get the surface cell's equivalent subsurface face - AmanziMesh::Entity_ID f = surface->entity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surface->getEntityParent(AmanziMesh::Entity_kind::CELL, c); #ifdef ENABLE_DBC - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); #endif // -- set that value to Neumann @@ -1230,19 +1220,18 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) // as Neumann BCs are in units of mols / s / A. The right A must // be chosen, as it is the subsurface mesh's face area, not the // surface mesh's cell area. - values[f] = ss_flux[0][c] / mesh_->face_area(f); + values[f] = ss_flux[0][c] / mesh_->getFaceArea(f); if (!kr && rel_perm[0][f] > 0.) values[f] /= rel_perm[0][f]; } } // mark all remaining boundary conditions as zero flux conditions - AmanziMesh::Entity_ID_List cells; int n_default = 0; - int nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); + int nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); for (int f = 0; f < nfaces_owned; f++) { if (markers[f] == Operators::OPERATOR_BC_NONE) { - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int ncells = cells.size(); if (ncells == 1) { @@ -1258,7 +1247,7 @@ Richards::UpdateBoundaryConditions_(const Tag& tag, bool kr) // report on counts if (vo_->os_OK(Teuchos::VERB_HIGH)) { std::vector bc_counts_global(bc_counts.size(), 0); - mesh_->get_comm()->SumAll(&bc_counts[0], &bc_counts_global[0], bc_counts.size()); + mesh_->getComm()->SumAll(&bc_counts[0], &bc_counts_global[0], bc_counts.size()); *vo_->os() << " BCs applied:" << std::endl; @@ -1401,8 +1390,7 @@ Richards::CalculateConsistentFaces(const Teuchos::Ptr& u) int f_owned = u_f.MyLength(); for (int f = 0; f != f_owned; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); int ncells = cells.size(); double face_value = 0.0; @@ -1439,7 +1427,7 @@ Richards::CalculateConsistentFaces(const Teuchos::Ptr& u) // ****************************************************************** */ // void Richards::ClipHydrostaticPressure(double pmin, Epetra_MultiVector& p) // { -// int ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); +// int ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); // for (int c = 0; c < ncells_owned; c++) p[0][c] = std::max(p[0][c], pmin); // } @@ -1496,8 +1484,8 @@ Richards::IsAdmissible(Teuchos::RCP up) double minT_l = minT; double maxT_l = maxT; - mesh_->get_comm()->MaxAll(&maxT_l, &maxT, 1); - mesh_->get_comm()->MinAll(&minT_l, &minT, 1); + mesh_->getComm()->MaxAll(&maxT_l, &maxT, 1); + mesh_->getComm()->MinAll(&minT_l, &minT, 1); if (vo_->os_OK(Teuchos::VERB_HIGH)) { *vo_->os() << " Admissible p? (min/max): " << minT << ", " << maxT << std::endl; @@ -1508,7 +1496,7 @@ Richards::IsAdmissible(Teuchos::RCP up) *vo_->os() << " is not admissible, as it is not within bounds of constitutive models:" << std::endl; - Teuchos::RCP comm_p = mesh_->get_comm(); + Teuchos::RCP comm_p = mesh_->getComm(); Teuchos::RCP mpi_comm_p = Teuchos::rcp_dynamic_cast(comm_p); const MPI_Comm& comm = mpi_comm_p->Comm(); @@ -1597,7 +1585,7 @@ Richards::ModifyCorrection(double h, } } } - mesh_->get_comm()->MaxAll(&my_limited, &n_limited_spurt, 1); + mesh_->getComm()->MaxAll(&my_limited, &n_limited_spurt, 1); } if (n_limited_spurt > 0) { @@ -1639,7 +1627,7 @@ Richards::ModifyCorrection(double h, } } - mesh_->get_comm()->MaxAll(&my_limited, &n_limited_change, 1); + mesh_->getComm()->MaxAll(&my_limited, &n_limited_change, 1); } // debugging -- remove me! --etc diff --git a/src/pks/mpc/mpc_coupled_water.cc b/src/pks/mpc/mpc_coupled_water.cc index 81850d2a3..4f790468c 100644 --- a/src/pks/mpc/mpc_coupled_water.cc +++ b/src/pks/mpc/mpc_coupled_water.cc @@ -59,7 +59,7 @@ MPCCoupledWater::Setup() Keys::readKey(*plist_, domain_surf_, "exfiltration flux", "surface_subsurface_flux"); S_->Require(exfilt_key_, tag_next_, exfilt_key_) .SetMesh(surf_mesh_) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireEvaluatorPrimary(exfilt_key_, tag_next_, *S_); // Create the preconditioner. @@ -95,23 +95,24 @@ MPCCoupledWater::Setup() // figure out what the corresponding cell of the surface system is. // Therefore, for all debug cells of the subsurface, if that cell is in the // top layer of cells, we add the corresponding face's surface cell. - AmanziMesh::Entity_ID_List debug_cells = domain_db_->get_cells(); + auto debug_cells = domain_db_->get_cells(); int ncells_surf = - surf_mesh_->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED); + surf_mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (debug_cells.size() > 0) { - const auto& domain_cell_map = domain_mesh_->cell_map(false); - const auto& surf_cell_map = surf_mesh_->cell_map(false); - AmanziMesh::Entity_ID_List surf_debug_cells; + const auto& domain_cell_map = domain_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + const auto& surf_cell_map = surf_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + AmanziMesh::Entity_ID_List surf_debug_cells_v; for (int sc = 0; sc != ncells_surf; ++sc) { - int f = surf_mesh_->entity_get_parent(AmanziMesh::Entity_kind::CELL, sc); - AmanziMesh::Entity_ID_List fcells; - domain_mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + int f = surf_mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); + auto fcells = domain_mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() == 1); auto gid = domain_cell_map.GID(fcells[0]); if (std::find(debug_cells.begin(), debug_cells.end(), gid) != debug_cells.end()) - surf_debug_cells.emplace_back(surf_cell_map.GID(sc)); + surf_debug_cells_v.emplace_back(surf_cell_map.GID(sc)); } + AmanziMesh::Entity_ID_View surf_debug_cells; + vectorToView(surf_debug_cells, surf_debug_cells_v); if (surf_debug_cells.size() > 0) surf_db_->add_cells(surf_debug_cells); } } @@ -356,7 +357,7 @@ MPCCoupledWater::ErrorNorm(Teuchos::RCP u, Teuchos::RCPGet("atmospheric_pressure", Tags::NEXT); for (int c = 0; c != u_surf_cell.MyLength(); ++c) { if (u_surf_cell[0][c] > p_atm) { - auto f = surf_mesh_->entity_get_parent(AmanziMesh::Entity_kind::CELL, c); + auto f = surf_mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, c); res_surf_cell[0][c] = res_face[0][f]; res_face[0][f] = 0.; } diff --git a/src/pks/mpc/mpc_delegate_ewc.cc b/src/pks/mpc/mpc_delegate_ewc.cc index d0b1d41ac..fa8c2c74b 100644 --- a/src/pks/mpc/mpc_delegate_ewc.cc +++ b/src/pks/mpc/mpc_delegate_ewc.cc @@ -131,7 +131,7 @@ MPCDelegateEWC::initialize() // initialize the Jacobian if (precon_type_ == PRECON_EWC || precon_type_ == PRECON_SMART_EWC) { - int ncells = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); jac_.resize(ncells, WhetStone::Tensor(2, 2)); } @@ -238,7 +238,7 @@ MPCDelegateEWC::update_precon_ewc_(double t, Teuchos::RCP up, *S_->GetDerivativePtr(wc_key_, tag_next_, pres_key_, tag_next_) ->ViewComponent("cell", false); - int ncells = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int c = 0; c != ncells; ++c) { jac_[c](0, 0) = dwcdp[0][c]; jac_[c](0, 1) = dwcdT[0][c]; diff --git a/src/pks/mpc/mpc_delegate_ewc_subsurface.cc b/src/pks/mpc/mpc_delegate_ewc_subsurface.cc index 8a54bfe77..7b008b6e6 100644 --- a/src/pks/mpc/mpc_delegate_ewc_subsurface.cc +++ b/src/pks/mpc/mpc_delegate_ewc_subsurface.cc @@ -93,7 +93,7 @@ MPCDelegateEWCSubsurface::modify_predictor_smart_ewc_(double h, Teuchos::RCPGetPtr(cv_key_, tag_next_)->ViewComponent("cell", false); - int rank = mesh_->get_comm()->MyPID(); + int rank = mesh_->getComm()->MyPID(); int ncells = wc0.MyLength(); for (int c = 0; c != ncells; ++c) { Teuchos::RCP dcvo = Teuchos::null; @@ -352,7 +352,7 @@ MPCDelegateEWCSubsurface::precon_ewc_(Teuchos::RCP u, Teuchos: double dT_min = 0.01; double dp_min = 100.; - int rank = mesh_->get_comm()->MyPID(); + int rank = mesh_->getComm()->MyPID(); int ncells = cv.MyLength(); for (int c = 0; c != ncells; ++c) { // debugger diff --git a/src/pks/mpc/mpc_delegate_ewc_surface.cc b/src/pks/mpc/mpc_delegate_ewc_surface.cc index bda9f2ceb..41b77194a 100644 --- a/src/pks/mpc/mpc_delegate_ewc_surface.cc +++ b/src/pks/mpc/mpc_delegate_ewc_surface.cc @@ -88,7 +88,7 @@ MPCDelegateEWCSurface::modify_predictor_smart_ewc_(double h, Teuchos::RCPGetPtr(cv_key_, tag_next_)->ViewComponent("cell", false); - int rank = mesh_->get_comm()->MyPID(); + int rank = mesh_->getComm()->MyPID(); int ncells = wc0.MyLength(); for (int c = 0; c != ncells; ++c) { Teuchos::RCP dcvo = Teuchos::null; @@ -222,7 +222,7 @@ MPCDelegateEWCSurface::precon_ewc_(Teuchos::RCP u, Teuchos::RC double dT_min = 0.01; double dp_min = 100.; - int rank = mesh_->get_comm()->MyPID(); + int rank = mesh_->getComm()->MyPID(); int ncells = cv.MyLength(); for (int c = 0; c != ncells; ++c) { // debugger diff --git a/src/pks/mpc/mpc_delegate_water.cc b/src/pks/mpc/mpc_delegate_water.cc index b4ea4e4a7..9965baca4 100644 --- a/src/pks/mpc/mpc_delegate_water.cc +++ b/src/pks/mpc/mpc_delegate_water.cc @@ -128,7 +128,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtDamp(double h, } Teuchos::RCP surf_mesh = u->SubVector(i_surf_)->Data()->Mesh(); - int ncells_surf = surf_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_surf = surf_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); Teuchos::RCP domain_u = u->SubVector(i_domain_)->Data(); Teuchos::RCP domain_Pu = Pu->SubVector(i_domain_)->Data(); @@ -139,7 +139,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtDamp(double h, double damp = 1.; if (damp_the_spurt_) { for (int cs = 0; cs != ncells_surf; ++cs) { - AmanziMesh::Entity_ID f = surf_mesh->entity_get_parent(AmanziMesh::CELL, cs); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, cs); double p_old = GetDomainFaceValue(*u->SubVector(i_domain_)->Data(), f); double p_Pu = GetDomainFaceValue(*Pu->SubVector(i_domain_)->Data(), f); double p_new = p_old - p_Pu; @@ -147,7 +147,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtDamp(double h, double my_damp = ((patm + cap_size_) - p_old) / (p_new - p_old); damp = std::min(damp, my_damp); if (vo_->os_OK(Teuchos::VERB_EXTREME)) - std::cout << " DAMPING THE SPURT (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " DAMPING THE SPURT (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl; } @@ -177,7 +177,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtCap(double h, const double& patm = S_->Get("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP surf_mesh = u->SubVector(i_surf_)->Data()->Mesh(); - int ncells_surf = surf_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_surf = surf_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); Teuchos::RCP domain_u = u->SubVector(i_domain_)->Data(); Teuchos::RCP domain_Pu = Pu->SubVector(i_domain_)->Data(); @@ -186,7 +186,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtCap(double h, int n_modified = 0; if (cap_the_spurt_) { for (int cs = 0; cs != ncells_surf; ++cs) { - AmanziMesh::Entity_ID f = surf_mesh->entity_get_parent(AmanziMesh::CELL, cs); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, cs); double p_old = GetDomainFaceValue(*u->SubVector(i_domain_)->Data(), f); double p_Pu = GetDomainFaceValue(*Pu->SubVector(i_domain_)->Data(), f); @@ -197,8 +197,8 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtCap(double h, n_modified++; if (vo_->os_OK(Teuchos::VERB_HIGH)) - std::cout << " CAPPING THE SPURT (sc=" << surf_mesh->cell_map(false).GID(cs) - << ",f=" << u->SubVector(i_domain_)->Data()->Mesh()->face_map(false).GID(f) + std::cout << " CAPPING THE SPURT (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) + << ",f=" << u->SubVector(i_domain_)->Data()->Mesh()->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f) << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << p_old - p_corrected << std::endl; } else if ((p_new < patm) && (p_old > patm)) { @@ -207,7 +207,7 @@ MPCDelegateWater::ModifyCorrection_WaterSpurtCap(double h, // SetDomainFaceValue(*domain_Pu, f, p_corrected); n_modified++; if (vo_->os_OK(Teuchos::VERB_HIGH)) - std::cout << " INVERSE SPURT (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " INVERSE SPURT (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << std::endl; } } @@ -227,7 +227,7 @@ MPCDelegateWater::ModifyCorrection_SaturatedSpurtDamp(double h, const double& patm = S_->Get("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP domain_mesh = u->SubVector(i_domain_)->Data()->Mesh(); - int ncells_domain = domain_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_domain = domain_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); const Epetra_MultiVector& domain_p_c = *u->SubVector(i_domain_)->Data()->ViewComponent("cell", false); @@ -244,7 +244,7 @@ MPCDelegateWater::ModifyCorrection_SaturatedSpurtDamp(double h, double my_damp = ((patm + cap_size_) - p_old) / (p_new - p_old); damp = std::min(damp, my_damp); if (vo_->os_OK(Teuchos::VERB_EXTREME)) - std::cout << " DAMPING THE SATURATED SPURT (c=" << domain_mesh->cell_map(false).GID(c) + std::cout << " DAMPING THE SATURATED SPURT (c=" << domain_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c) << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl; } @@ -274,7 +274,7 @@ MPCDelegateWater::ModifyCorrection_SaturatedSpurtCap(double h, const double& patm = S_->Get("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP domain_mesh = u->SubVector(i_domain_)->Data()->Mesh(); - int ncells_domain = domain_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_domain = domain_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); const Epetra_MultiVector& domain_p_c = *u->SubVector(i_domain_)->Data()->ViewComponent("cell", false); @@ -291,7 +291,7 @@ MPCDelegateWater::ModifyCorrection_SaturatedSpurtCap(double h, domain_Pu_c[0][c] = p_old - (patm + cap_size_); n_modified++; if (vo_->os_OK(Teuchos::VERB_HIGH)) - std::cout << " CAPPING THE SATURATED SPURT (c=" << domain_mesh->cell_map(false).GID(c) + std::cout << " CAPPING THE SATURATED SPURT (c=" << domain_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c) << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << p_old - domain_Pu_c[0][c] << std::endl; } @@ -312,7 +312,7 @@ MPCDelegateWater::ModifyCorrection_DesaturatedSpurtDamp(double h, const double& patm = S_->Get("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP domain_mesh = u->SubVector(i_domain_)->Data()->Mesh(); - int ncells_domain = domain_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_domain = domain_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); const Epetra_MultiVector& domain_p_c = *u->SubVector(i_domain_)->Data()->ViewComponent("cell", false); @@ -329,7 +329,7 @@ MPCDelegateWater::ModifyCorrection_DesaturatedSpurtDamp(double h, double my_damp = ((patm - cap_size_) - p_old) / (p_new - p_old); damp = std::min(damp, my_damp); if (vo_->os_OK(Teuchos::VERB_EXTREME)) - std::cout << " DAMPING THE DESATURATED SPURT (c=" << domain_mesh->cell_map(false).GID(c) + std::cout << " DAMPING THE DESATURATED SPURT (c=" << domain_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c) << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl; } @@ -359,7 +359,7 @@ MPCDelegateWater::ModifyCorrection_DesaturatedSpurtCap(double h, const double& patm = S_->Get("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP domain_mesh = u->SubVector(i_domain_)->Data()->Mesh(); - int ncells_domain = domain_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_domain = domain_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); const Epetra_MultiVector& domain_p_c = *u->SubVector(i_domain_)->Data()->ViewComponent("cell", false); @@ -376,7 +376,7 @@ MPCDelegateWater::ModifyCorrection_DesaturatedSpurtCap(double h, domain_Pu_c[0][c] = p_old - (patm - cap_size_); n_modified++; if (vo_->os_OK(Teuchos::VERB_HIGH)) - std::cout << " CAPPING THE DESATURATED SPURT (c=" << domain_mesh->cell_map(false).GID(c) + std::cout << " CAPPING THE DESATURATED SPURT (c=" << domain_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(c) << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << p_old - domain_Pu_c[0][c] << std::endl; } @@ -405,7 +405,7 @@ MPCDelegateWater::ModifyPredictor_Heuristic(double h, const Teuchos::RCPGet("atmospheric_pressure", Tags::DEFAULT); int ncells = surf_u_c.MyLength(); for (int c = 0; c != ncells; ++c) { - int f = surf_mesh->entity_get_parent(AmanziMesh::CELL, c); + int f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, c); double dp = surf_u_c[0][c] - surf_u_prev_c[0][c]; double pnew = surf_u_c[0][c] - patm; @@ -446,7 +446,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPGet("atmospheric_pressure", Tags::DEFAULT); Teuchos::RCP surf_mesh = u->SubVector(i_surf_)->Data()->Mesh(); - int ncells_surf = surf_mesh->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); + int ncells_surf = surf_mesh->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); Epetra_MultiVector& surf_pnew_c = *u->SubVector(i_surf_)->Data()->ViewComponent("cell", false); Teuchos::RCP domain_pnew = u->SubVector(i_domain_)->Data(); @@ -455,10 +455,10 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPGetPtr(key_ss, tag_current_); - int rank = surf_mesh->get_comm()->MyPID(); + int rank = surf_mesh->getComm()->MyPID(); double damp = 1.; for (unsigned int cs = 0; cs != ncells_surf; ++cs) { - AmanziMesh::Entity_ID f = surf_mesh->entity_get_parent(AmanziMesh::CELL, cs); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, cs); double p_old = GetDomainFaceValue(*domain_pold, f); double p_new = GetDomainFaceValue(*domain_pnew, f); if ((p_new > patm + cap_size_) && (p_old < patm)) { @@ -466,7 +466,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPos_OK(Teuchos::VERB_EXTREME)) - std::cout << " DAMPING THE SPURT (1st over) (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " DAMPING THE SPURT (1st over) (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl; } else if ((p_old > patm) && (p_new - p_old > p_old - patm)) { @@ -474,7 +474,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPos_OK(Teuchos::VERB_EXTREME)) - std::cout << " DAMPING THE SPURT (2nd over) (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " DAMPING THE SPURT (2nd over) (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << ", coef = " << my_damp << std::endl; } @@ -501,7 +501,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPentity_get_parent(AmanziMesh::CELL, cs); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, cs); double p_old = GetDomainFaceValue(*domain_pnew, f); ; double p_new = GetDomainFaceValue(*domain_pnew, f); @@ -512,7 +512,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPos_OK(Teuchos::VERB_HIGH)) - std::cout << " CAPPING THE SPURT (1st over) (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " CAPPING THE SPURT (1st over) (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << new_value << std::endl; } else if ((p_old > patm) && (p_new - p_old > p_old - patm)) { @@ -522,7 +522,7 @@ MPCDelegateWater::ModifyPredictor_WaterSpurtDamp(double h, const Teuchos::RCPos_OK(Teuchos::VERB_HIGH)) - std::cout << " CAPPING THE SPURT (2nd over) (sc=" << surf_mesh->cell_map(false).GID(cs) + std::cout << " CAPPING THE SPURT (2nd over) (sc=" << surf_mesh->getMap(AmanziMesh::Entity_kind::CELL,false).GID(cs) << "): p_old = " << p_old << ", p_new = " << p_new << ", p_capped = " << new_value << std::endl; } else { @@ -578,7 +578,7 @@ MPCDelegateWater::ModifyPredictor_TempFromSource(double h, const Teuchos::RCPentity_get_parent(AmanziMesh::CELL, c); + AmanziMesh::Entity_ID f = surf_mesh->getEntityParent(AmanziMesh::Entity_kind::CELL, c); SetDomainFaceValue(*domain_pnew, f, surf_pnew_c[0][c]); } } diff --git a/src/pks/mpc/mpc_permafrost.cc b/src/pks/mpc/mpc_permafrost.cc index a58ab7d65..9d5372cf7 100644 --- a/src/pks/mpc/mpc_permafrost.cc +++ b/src/pks/mpc/mpc_permafrost.cc @@ -119,13 +119,13 @@ MPCPermafrost::Setup() if (pk0_method == "nlfv: bnd_faces" || pk0_method == "fv: bnd_faces") { cvs->SetMesh(domain_mesh_) ->SetGhosted() - ->AddComponent("boundary_face", AmanziMesh::BOUNDARY_FACE, 1) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("boundary_face", AmanziMesh::Entity_kind::BOUNDARY_FACE, 1) + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { cvs->SetMesh(domain_mesh_) ->SetGhosted() - ->AddComponent("face", AmanziMesh::FACE, 1) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("face", AmanziMesh::Entity_kind::FACE, 1) + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } dE_dp_block_ = Teuchos::rcp(new Operators::Operator_FaceCell(cvs, plist)); @@ -137,10 +137,10 @@ MPCPermafrost::Setup() // require the coupling fields, claim ownership requireAtNext(mass_exchange_key_, tag_next_, *S_, mass_exchange_key_) .SetMesh(surf_mesh_) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(energy_exchange_key_, tag_next_, *S_, energy_exchange_key_) .SetMesh(surf_mesh_) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // require in case the PK did not do so already requireAtNext(surf_pd_key_, tag_next_, *S_) @@ -258,43 +258,45 @@ MPCPermafrost::Setup() // Therefore, for all debug cells of the subsurface, if that cell is in the // top layer of cells, we add the corresponding face's surface cell. { - AmanziMesh::Entity_ID_List debug_cells = domain_db_->get_cells(); + auto debug_cells = domain_db_->get_cells(); int ncells_surf = - surf_mesh_->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED); + surf_mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (debug_cells.size() > 0) { - const auto& domain_cell_map = domain_mesh_->cell_map(false); - const auto& surf_cell_map = surf_mesh_->cell_map(false); - AmanziMesh::Entity_ID_List surf_debug_cells; + const auto& domain_cell_map = domain_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + const auto& surf_cell_map = surf_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + AmanziMesh::Entity_ID_List surf_debug_cells_v; for (int sc = 0; sc != ncells_surf; ++sc) { - int f = surf_mesh_->entity_get_parent(AmanziMesh::Entity_kind::CELL, sc); - AmanziMesh::Entity_ID_List fcells; - domain_mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + int f = surf_mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); + auto fcells = domain_mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() == 1); auto gid = domain_cell_map.GID(fcells[0]); if (std::find(debug_cells.begin(), debug_cells.end(), gid) != debug_cells.end()) - surf_debug_cells.emplace_back(surf_cell_map.GID(sc)); + surf_debug_cells_v.emplace_back(surf_cell_map.GID(sc)); } + AmanziMesh::Entity_ID_View surf_debug_cells; + vectorToView(surf_debug_cells, surf_debug_cells_v); if (surf_debug_cells.size() > 0) surf_db_->add_cells(surf_debug_cells); } } // do the same for energy { - AmanziMesh::Entity_ID_List debug_cells = domain_energy_pk_->debugger()->get_cells(); + auto debug_cells = domain_energy_pk_->debugger()->get_cells(); int ncells_surf = - surf_mesh_->num_entities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED); + surf_mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (debug_cells.size() > 0) { - const auto& domain_cell_map = domain_mesh_->cell_map(false); - const auto& surf_cell_map = surf_mesh_->cell_map(false); - AmanziMesh::Entity_ID_List surf_debug_cells; + const auto& domain_cell_map = domain_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + const auto& surf_cell_map = surf_mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); + AmanziMesh::Entity_ID_List surf_debug_cells_v; for (int sc = 0; sc != ncells_surf; ++sc) { - int f = surf_mesh_->entity_get_parent(AmanziMesh::Entity_kind::CELL, sc); - AmanziMesh::Entity_ID_List fcells; - domain_mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &fcells); + int f = surf_mesh_->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); + auto fcells = domain_mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(fcells.size() == 1); auto gid = domain_cell_map.GID(fcells[0]); if (std::find(debug_cells.begin(), debug_cells.end(), gid) != debug_cells.end()) - surf_debug_cells.emplace_back(surf_cell_map.GID(sc)); + surf_debug_cells_v.emplace_back(surf_cell_map.GID(sc)); } + AmanziMesh::Entity_ID_View surf_debug_cells; + vectorToView(surf_debug_cells, surf_debug_cells_v); if (surf_debug_cells.size() > 0) surf_db_->add_cells(surf_debug_cells); } } diff --git a/src/pks/mpc/mpc_subsurface.cc b/src/pks/mpc/mpc_subsurface.cc index 8b560008b..fadf6c658 100644 --- a/src/pks/mpc/mpc_subsurface.cc +++ b/src/pks/mpc/mpc_subsurface.cc @@ -102,7 +102,7 @@ MPCSubsurface::Setup() S_->Require(rho_key_, tag_next_) .SetMesh(mesh_) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S_->RequireEvaluator(rho_key_, tag_next_); // see amanzi/ats#167 @@ -167,7 +167,7 @@ MPCSubsurface::Setup() std::vector locations2(2); std::vector names2(2); std::vector num_dofs2(2, 1); - locations2[0] = AmanziMesh::CELL; + locations2[0] = AmanziMesh::Entity_kind::CELL; names2[0] = "cell"; // Create the block for derivatives of mass conservation with respect to temperature @@ -183,7 +183,7 @@ MPCSubsurface::Setup() S_->Require(duw_krdT_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->GetRecordW(duw_krdT_key_, tag_next_, name_).set_io_vis(false); upwinding_dkrdT_ = Teuchos::rcp( @@ -211,10 +211,10 @@ MPCSubsurface::Setup() // see amanzi/ats#167 // if (S_->GetEvaluator(wc_key_, tag_next_).IsDifferentiableWRT(*S_, temp_key_, tag_next_)) { if (dWC_dT_block_ == Teuchos::null) { - dWC_dT_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, mesh_)); + dWC_dT_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, mesh_)); dWC_dT_block_ = dWC_dT_->global_operator(); } else { - dWC_dT_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, dWC_dT_block_)); + dWC_dT_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, dWC_dT_block_)); } // } @@ -232,7 +232,7 @@ MPCSubsurface::Setup() S_->Require(duw_tcdp_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->GetRecordW(duw_tcdp_key_, tag_next_, name_).set_io_vis(false); upwinding_dkappa_dp_ = @@ -305,7 +305,7 @@ MPCSubsurface::Setup() // -- now the field names2[1] = "boundary_face"; - locations2[1] = AmanziMesh::BOUNDARY_FACE; + locations2[1] = AmanziMesh::Entity_kind::BOUNDARY_FACE; S_->Require(hkr_key_, tag_next_) .SetMesh(mesh_) ->SetGhosted() @@ -315,7 +315,7 @@ MPCSubsurface::Setup() S_->Require(uw_hkr_key_, tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->GetRecordW(uw_hkr_key_, tag_next_, name_).set_io_vis(false); S_->RequireDerivative( @@ -339,14 +339,14 @@ MPCSubsurface::Setup() if (!is_fv_) { // -- and the upwinded field - locations2[1] = AmanziMesh::FACE; + locations2[1] = AmanziMesh::Entity_kind::FACE; names2[1] = "face"; S_->Require( Keys::getDerivKey(uw_hkr_key_, pres_key_), tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->GetRecordW(Keys::getDerivKey(uw_hkr_key_, pres_key_), tag_next_, name_) .set_io_vis(false); @@ -354,7 +354,7 @@ MPCSubsurface::Setup() Keys::getDerivKey(uw_hkr_key_, temp_key_), tag_next_, name_) .SetMesh(mesh_) ->SetGhosted() - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->GetRecordW(Keys::getDerivKey(uw_hkr_key_, temp_key_), tag_next_, name_) .set_io_vis(false); @@ -370,10 +370,10 @@ MPCSubsurface::Setup() // see amanzi/ats#167 // if (S_->GetEvaluator(wc_key_, tag_next_).IsDifferentiableWRT(*S_, temp_key_, tag_next_)) { if (dE_dp_block_ == Teuchos::null) { - dE_dp_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, mesh_)); + dE_dp_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, mesh_)); dE_dp_block_ = dE_dp_->global_operator(); } else { - dE_dp_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, dE_dp_block_)); + dE_dp_ = Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, dE_dp_block_)); } // } @@ -614,14 +614,14 @@ MPCSubsurface::UpdatePreconditioner(double t, Teuchos::RCP up, enth_kr_uw->ViewComponent("face", false) ->Export( - *enth_kr->ViewComponent("boundary_face", false), mesh_->exterior_face_importer(), Insert); + *enth_kr->ViewComponent("boundary_face", false), mesh_->getBoundaryFaceImporter(), Insert); upwinding_hkr_->Update(*enth_kr, *enth_kr_uw, *S_); // -- stick zeros in the boundary faces Epetra_MultiVector enth_kr_bf(*enth_kr->ViewComponent("boundary_face", false)); enth_kr_bf.PutScalar(0.0); enth_kr_uw->ViewComponent("face", false) - ->Export(enth_kr_bf, mesh_->exterior_face_importer(), Insert); + ->Export(enth_kr_bf, mesh_->getBoundaryFaceImporter(), Insert); if (is_fv_) { denth_kr_dp_uw = @@ -645,11 +645,11 @@ MPCSubsurface::UpdatePreconditioner(double t, Teuchos::RCP up, // -- copy boundary faces into upwinded vector denth_kr_dp_uw_nc->ViewComponent("face", false) ->Export(*denth_kr_dp->ViewComponent("boundary_face", false), - mesh_->exterior_face_importer(), + mesh_->getBoundaryFaceImporter(), Insert); denth_kr_dT_uw_nc->ViewComponent("face", false) ->Export(*denth_kr_dT->ViewComponent("boundary_face", false), - mesh_->exterior_face_importer(), + mesh_->getBoundaryFaceImporter(), Insert); // -- upwind @@ -660,9 +660,9 @@ MPCSubsurface::UpdatePreconditioner(double t, Teuchos::RCP up, Epetra_MultiVector enth_kr_bf(*enth_kr->ViewComponent("boundary_face", false)); enth_kr_bf.PutScalar(0.0); denth_kr_dp_uw_nc->ViewComponent("face", false) - ->Export(enth_kr_bf, mesh_->exterior_face_importer(), Insert); + ->Export(enth_kr_bf, mesh_->getBoundaryFaceImporter(), Insert); denth_kr_dT_uw_nc->ViewComponent("face", false) - ->Export(enth_kr_bf, mesh_->exterior_face_importer(), Insert); + ->Export(enth_kr_bf, mesh_->getBoundaryFaceImporter(), Insert); denth_kr_dp_uw = S_->GetPtr(Keys::getDerivKey(uw_hkr_key_, pres_key_), tag_next_); diff --git a/src/pks/mpc/mpc_surface_subsurface_helpers.cc b/src/pks/mpc/mpc_surface_subsurface_helpers.cc index bac18c58f..075749ef8 100644 --- a/src/pks/mpc/mpc_surface_subsurface_helpers.cc +++ b/src/pks/mpc/mpc_surface_subsurface_helpers.cc @@ -18,7 +18,7 @@ CopySurfaceToSubsurface(const CompositeVector& surf, CompositeVector& sub) const Epetra_MultiVector& surf_c = *surf.ViewComponent("cell", false); for (unsigned int sc = 0; sc != surf_c.MyLength(); ++sc) { - AmanziMesh::Entity_ID f = surf.Mesh()->entity_get_parent(AmanziMesh::CELL, sc); + AmanziMesh::Entity_ID f = surf.Mesh()->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); SetDomainFaceValue(sub, f, surf_c[0][sc]); } } @@ -30,7 +30,7 @@ CopySubsurfaceToSurface(const CompositeVector& sub, CompositeVector& surf) Epetra_MultiVector& surf_c = *surf.ViewComponent("cell", false); for (unsigned int sc = 0; sc != surf_c.MyLength(); ++sc) { - AmanziMesh::Entity_ID f = surf.Mesh()->entity_get_parent(AmanziMesh::CELL, sc); + AmanziMesh::Entity_ID f = surf.Mesh()->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); surf_c[0][sc] = GetDomainFaceValue(sub, f); } } @@ -45,7 +45,7 @@ MergeSubsurfaceAndSurfacePressure(const CompositeVector& h_prev, double p_atm = 101325.; for (unsigned int sc = 0; sc != surf_p_c.MyLength(); ++sc) { - AmanziMesh::Entity_ID f = surf_p.Mesh()->entity_get_parent(AmanziMesh::CELL, sc); + AmanziMesh::Entity_ID f = surf_p.Mesh()->getEntityParent(AmanziMesh::Entity_kind::CELL, sc); if (h_c[0][sc] > 0. && surf_p_c[0][sc] > p_atm) { SetDomainFaceValue(sub_p, f, surf_p_c[0][sc]); } else { @@ -72,7 +72,7 @@ GetDomainFaceValue(const CompositeVector& sub_p, int f) return vec[0][f]; ; } else if (face_entity == "boundary_face") { - int bf = sub_p.Mesh()->exterior_face_map(false).LID(sub_p.Mesh()->face_map(false).GID(f)); + int bf = sub_p.Mesh()->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false).LID(sub_p.Mesh()->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f)); const Epetra_MultiVector& vec = *sub_p.ViewComponent(face_entity, false); return vec[0][bf]; } else { @@ -97,7 +97,7 @@ SetDomainFaceValue(CompositeVector& sub_p, int f, double value) Epetra_MultiVector& vec = *sub_p.ViewComponent(face_entity, false); vec[0][f] = value; } else if (face_entity == "boundary_face") { - int bf = sub_p.Mesh()->exterior_face_map(false).LID(sub_p.Mesh()->face_map(false).GID(f)); + int bf = sub_p.Mesh()->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false).LID(sub_p.Mesh()->getMap(AmanziMesh::Entity_kind::FACE,false).GID(f)); Epetra_MultiVector& vec = *sub_p.ViewComponent(face_entity, false); vec[0][bf] = value; } diff --git a/src/pks/mpc/mpc_weak_subdomain.cc b/src/pks/mpc/mpc_weak_subdomain.cc index e0d6e5bc9..77e52e2c2 100644 --- a/src/pks/mpc/mpc_weak_subdomain.cc +++ b/src/pks/mpc/mpc_weak_subdomain.cc @@ -304,7 +304,7 @@ MPCWeakSubdomain::init_() // get the domain set and save the comm of the parent mesh for later ds_name_ = std::get<0>(subdomain_triple); const auto& ds = S_->GetDomainSet(ds_name_); - comm_ = ds->get_indexing_parent()->get_comm(); + comm_ = ds->getIndexingParent()->getComm(); // -- create the lifted PKs PKFactory pk_factory; @@ -313,7 +313,7 @@ MPCWeakSubdomain::init_() // create the solution vector, noting that these are created on the // communicator associated with the mesh of the subdomain, which may differ // from the coupler's comm. - Teuchos::RCP pk_soln = Teuchos::rcp(new TreeVector(mesh->get_comm())); + Teuchos::RCP pk_soln = Teuchos::rcp(new TreeVector(mesh->getComm())); solution_->PushBack(pk_soln); // create the PK diff --git a/src/pks/pk_helpers.cc b/src/pks/pk_helpers.cc index b5691e0c0..f7f18410a 100644 --- a/src/pks/pk_helpers.cc +++ b/src/pks/pk_helpers.cc @@ -42,8 +42,8 @@ applyDirichletBCs(const Operators::BCs& bcs, CompositeVector& u) if (u.HasComponent("boundary_face")) { Epetra_MultiVector& u_bf = *u.ViewComponent("boundary_face", false); const Epetra_MultiVector& u_c = *u.ViewComponent("cell", false); - const Epetra_Map& vandalay_map = u.Mesh()->exterior_face_map(false); - const Epetra_Map& face_map = u.Mesh()->face_map(false); + const Epetra_Map& vandalay_map = u.Mesh()->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = u.Mesh()->getMap(AmanziMesh::Entity_kind::FACE,false); for (int bf = 0; bf != u_bf.MyLength(); ++bf) { AmanziMesh::Entity_ID f = face_map.LID(vandalay_map.GID(bf)); @@ -88,12 +88,9 @@ getFaceOnBoundaryValue(AmanziMesh::Entity_ID f, const CompositeVector& u, const int getBoundaryDirection(const AmanziMesh::Mesh& mesh, AmanziMesh::Entity_ID f) { - AmanziMesh::Entity_ID_List cells; - mesh.face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh.getFaceCells(f, AmanziMesh::Parallel_kind::ALL); AMANZI_ASSERT(cells.size() == 1); - AmanziMesh::Entity_ID_List faces; - std::vector dirs; - mesh.cell_get_faces_and_dirs(cells[0], &faces, &dirs); + const auto& [faces, dirs] = mesh.getCellFacesAndDirections(cells[0]); return dirs[std::find(faces.begin(), faces.end(), f) - faces.begin()]; } @@ -290,10 +287,10 @@ copyMeshCoordinatesToVector(const AmanziMesh::Mesh& mesh, CompositeVector& vec) { Epetra_MultiVector& nodes = *vec.ViewComponent("node", true); - int ndim = mesh.space_dimension(); + int ndim = mesh.getSpaceDimension(); AmanziGeometry::Point nc; for (int i = 0; i != nodes.MyLength(); ++i) { - mesh.node_get_coordinates(i, &nc); + nc = mesh.getNodeCoordinate(i); for (int j = 0; j != ndim; ++j) nodes[j][i] = nc[j]; } } @@ -302,19 +299,19 @@ void copyVectorToMeshCoordinates(const CompositeVector& vec, AmanziMesh::Mesh& mesh) { const Epetra_MultiVector& nodes = *vec.ViewComponent("node", true); - int ndim = mesh.space_dimension(); + int ndim = mesh.getSpaceDimension(); - std::vector node_ids(nodes.MyLength()); - Amanzi::AmanziGeometry::Point_List new_positions(nodes.MyLength()); + Amanzi::AmanziMesh::Entity_ID_View node_ids("node_ids", nodes.MyLength()); + Amanzi::AmanziMesh::Point_View new_positions("new_positions", nodes.MyLength()); for (int n = 0; n != nodes.MyLength(); ++n) { node_ids[n] = n; - if (mesh.space_dimension() == 2) { + if (mesh.getSpaceDimension() == 2) { new_positions[n] = Amanzi::AmanziGeometry::Point{ nodes[0][n], nodes[1][n] }; } else { new_positions[n] = Amanzi::AmanziGeometry::Point{ nodes[0][n], nodes[1][n], nodes[2][n] }; } } - mesh.deform(node_ids, new_positions); + Amanzi::AmanziMesh::MeshAlgorithms::deform(mesh, node_ids, new_positions); } int diff --git a/src/pks/pk_physical_bdf_default.cc b/src/pks/pk_physical_bdf_default.cc index 3551b5762..dcba1e47e 100644 --- a/src/pks/pk_physical_bdf_default.cc +++ b/src/pks/pk_physical_bdf_default.cc @@ -31,7 +31,7 @@ PK_PhysicalBDF_Default::Setup() PK_BDF_Default::Setup(); // boundary conditions - bc_ = Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::FACE, WhetStone::DOF_Type::SCALAR)); + bc_ = Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::Entity_kind::FACE, WhetStone::DOF_Type::SCALAR)); // convergence criteria is based on a conserved quantity if (conserved_key_.empty()) { @@ -39,7 +39,7 @@ PK_PhysicalBDF_Default::Setup() } requireAtNext(conserved_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, true); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, true); // we also use a copy of the conserved quantity, as this is a better choice in the error norm requireAtCurrent(conserved_key_, tag_current_, *S_, name_, true); @@ -49,7 +49,7 @@ PK_PhysicalBDF_Default::Setup() } requireAtNext(cell_vol_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, true); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, true); atol_ = plist_->get("absolute error tolerance", 1.0); rtol_ = plist_->get("relative error tolerance", 1.0); @@ -105,7 +105,7 @@ PK_PhysicalBDF_Default::ErrorNorm(Teuchos::RCP u, Teuchos::RCP dvec = res->Data(); double h = S_->get_time(tag_next_) - S_->get_time(tag_current_); - Teuchos::RCP comm_p = mesh_->get_comm(); + Teuchos::RCP comm_p = mesh_->getComm(); Teuchos::RCP mpi_comm_p = Teuchos::rcp_dynamic_cast(comm_p); const MPI_Comm& comm = mpi_comm_p->Comm(); @@ -135,8 +135,7 @@ PK_PhysicalBDF_Default::ErrorNorm(Teuchos::RCP u, int nfaces = dvec->size(*comp, false); for (unsigned int f = 0; f != nfaces; ++f) { - AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::OWNED, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::OWNED); double cv_min = cells.size() == 1 ? cv[0][cells[0]] : std::min(cv[0][cells[0]], cv[0][cells[1]]); double conserved_min = cells.size() == 1 ? diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/albedo_threecomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/albedo_threecomponent_evaluator.cc index 3c62f06e2..e123cb38b 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/albedo_threecomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/albedo_threecomponent_evaluator.cc @@ -76,9 +76,8 @@ AlbedoThreeComponentEvaluator::Evaluate_(const State& S, emissivity(2)->PutScalar(e_snow_); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // albedo of the snow @@ -123,9 +122,9 @@ AlbedoThreeComponentEvaluator::EnsureCompatibility_ToDeps_(State& S) for (auto dep : dependencies_) { auto& fac = S.Require(dep.first, dep.second); if (Keys::getDomain(dep.first) == domain_snow_) { - fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { - fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/albedo_twocomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/albedo_twocomponent_evaluator.cc index d7467e3c5..734a9ccaa 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/albedo_twocomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/albedo_twocomponent_evaluator.cc @@ -80,9 +80,8 @@ AlbedoTwoComponentEvaluator::Evaluate_(const State& S, const std::vectorPutScalar(e_snow_); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // albedo of the snow @@ -136,9 +135,9 @@ AlbedoTwoComponentEvaluator::EnsureCompatibility_ToDeps_(State& S) for (auto dep : dependencies_) { auto& fac = S.Require(dep.first, dep.second); if (Keys::getDomain(dep.first) == domain_snow_) { - fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { - fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_threecomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_threecomponent_evaluator.cc index 695bcfa3b..dcbd50cfb 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_threecomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_threecomponent_evaluator.cc @@ -55,9 +55,8 @@ AreaFractionsThreeComponentEvaluator::Evaluate_(const State& S, const auto& pd = *S.Get(ponded_depth_key_, tag).ViewComponent("cell", false); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // calculate area of land @@ -132,7 +131,7 @@ AreaFractionsThreeComponentEvaluator::Evaluate_(const State& S, if (std::abs(1 - res[0][c] - res[1][c] - res[2][c]) > 1e-10) nerr++; } int nerr_global = 0; - mesh->get_comm()->SumAll(&nerr, &nerr_global, 1); + mesh->getComm()->SumAll(&nerr, &nerr_global, 1); if (nerr_global > 0) { Errors::Message msg("AreaFractionsTwoComponent: land cover types do not cover the mesh."); Exceptions::amanzi_throw(msg); @@ -158,9 +157,9 @@ AreaFractionsThreeComponentEvaluator::EnsureCompatibility_ToDeps_(State& S) for (auto& dep : dependencies_) { auto& fac = S.Require(dep.first, dep.second); if (Keys::getDomain(dep.first) == domain_snow_) { - fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { - fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_twocomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_twocomponent_evaluator.cc index 7c22e11ee..45509c8fa 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_twocomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/area_fractions_twocomponent_evaluator.cc @@ -52,9 +52,8 @@ AreaFractionsTwoComponentEvaluator::Evaluate_(const State& S, const auto& sd = *S.Get(snow_depth_key_, tag).ViewComponent("cell", false); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // calculate area of land @@ -82,7 +81,7 @@ AreaFractionsTwoComponentEvaluator::Evaluate_(const State& S, if (std::abs(1 - res[0][c] - res[1][c]) > 1e-10) nerr++; } int nerr_global = 0; - mesh->get_comm()->SumAll(&nerr, &nerr_global, 1); + mesh->getComm()->SumAll(&nerr, &nerr_global, 1); if (nerr_global > 0) { Errors::Message msg("AreaFractionsTwoComponent: land cover types do not cover the mesh."); Exceptions::amanzi_throw(msg); @@ -119,9 +118,9 @@ AreaFractionsTwoComponentEvaluator::EnsureCompatibility_ToDeps_(State& S) for (auto dep : dependencies_) { auto& fac = S.Require(dep.first, dep.second); if (Keys::getDomain(dep.first) == domain_snow_) { - fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_snow_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } else { - fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/canopy_radiation_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/canopy_radiation_evaluator.cc index 20e7dfd6c..a9859491c 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/canopy_radiation_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/canopy_radiation_evaluator.cc @@ -107,9 +107,8 @@ CanopyRadiationEvaluator::Evaluate_(const State& S, const std::vectorMesh(); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // NOTE: emissivity = absorptivity, we use e to notate both diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/evaporation_downregulation_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/evaporation_downregulation_evaluator.cc index 38dfce8fa..62e236323 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/evaporation_downregulation_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/evaporation_downregulation_evaluator.cc @@ -71,12 +71,11 @@ EvaporationDownregulationEvaluator::Evaluate_(const State& S, auto& surf_mesh = *S.GetMesh(domain_surf_); for (const auto& region_model : models_) { - AmanziMesh::Entity_ID_List lc_ids; - surf_mesh.get_set_entities( - region_model.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = surf_mesh.getSetEntities( + region_model.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (AmanziMesh::Entity_ID sc : lc_ids) { - auto c = sub_mesh.cells_of_column(sc)[0]; + auto c = sub_mesh.columns.getCells(sc)[0]; surf_evap[0][sc] = region_model.second->Evaporation(sat_gas[0][c], poro[0][c], pot_evap[0][sc]); } @@ -104,13 +103,11 @@ EvaporationDownregulationEvaluator::EvaluatePartialDerivative_( auto& surf_mesh = *S.GetMesh(domain_surf_); for (const auto& region_model : models_) { - AmanziMesh::Entity_ID_List lc_ids; - surf_mesh.get_set_entities(region_model.first, + auto lc_ids = surf_mesh.getSetEntities(region_model.first, AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED, - &lc_ids); + AmanziMesh::Parallel_kind::OWNED); for (AmanziMesh::Entity_ID sc : lc_ids) { - auto c = sub_mesh.cells_of_column(sc)[0]; + auto c = sub_mesh.columns.getCells(sc)[0]; surf_evap[0][sc] = region_model.second->DEvaporationDPotentialEvaporation( sat_gas[0][c], poro[0][c], pot_evap[0][sc]); } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/pet_priestley_taylor_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/pet_priestley_taylor_evaluator.cc index 901d10c0e..120793fe1 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/pet_priestley_taylor_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/pet_priestley_taylor_evaluator.cc @@ -128,9 +128,8 @@ PETPriestleyTaylorEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("cell", false); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); double alpha = 0.; bool is_snow = false; @@ -236,13 +235,13 @@ PETPriestleyTaylorEvaluator::EnsureCompatibility_ToDeps_(State& S) if (dep.first == limiter_key_) { fac.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, limiter_nvecs_); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, limiter_nvecs_); } else if (dep.first == one_minus_limiter_key_) { fac.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, one_minus_limiter_nvecs_); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, one_minus_limiter_nvecs_); } else { - fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/plant_wilting_factor_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/plant_wilting_factor_evaluator.cc index a5edf4236..78b8134b8 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/plant_wilting_factor_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/plant_wilting_factor_evaluator.cc @@ -53,12 +53,11 @@ PlantWiltingFactorEvaluator::Evaluate_(const State& S, const std::vectorPlantWiltingFactor(pc_v[0][c]); } } @@ -82,14 +81,12 @@ PlantWiltingFactorEvaluator::EvaluatePartialDerivative_(const State& S, auto& surf_mesh = *S.GetMesh(domain_surf_); for (const auto& region_model : models_) { - AmanziMesh::Entity_ID_List lc_ids; - surf_mesh.get_set_entities(region_model.first, + auto lc_ids = surf_mesh.getSetEntities(region_model.first, AmanziMesh::Entity_kind::CELL, - AmanziMesh::Parallel_type::OWNED, - &lc_ids); + AmanziMesh::Parallel_kind::OWNED); for (int sc : lc_ids) { - for (auto c : subsurf_mesh.cells_of_column(sc)) { + for (auto c : subsurf_mesh.columns.getCells(sc)) { result_v[0][c] = region_model.second->DPlantWiltingFactorDCapillaryPressureGasLiq(pc_v[0][c]); } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/radiation_balance_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/radiation_balance_evaluator.cc index 1c672821c..00494f196 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/radiation_balance_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/radiation_balance_evaluator.cc @@ -135,9 +135,8 @@ RadiationBalanceEvaluator::Evaluate_(const State& S, const std::vectorMesh(); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { // NOTE: emissivity = absorptivity, we use e to notate both diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/rooting_depth_fraction_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/rooting_depth_fraction_evaluator.cc index 4b11d7bba..b9f5d15a7 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/rooting_depth_fraction_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/rooting_depth_fraction_evaluator.cc @@ -70,21 +70,20 @@ RootingDepthFractionEvaluator::Evaluate_(const State& S, auto& surf_mesh = *S.GetMesh(domain_surf_); for (const auto& region_model : models_) { - AmanziMesh::Entity_ID_List lc_ids; - surf_mesh.get_set_entities( - region_model.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = surf_mesh.getSetEntities( + region_model.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (int sc : lc_ids) { double column_total = 0.; double f_root_total = 0.; - for (auto c : subsurf_mesh.cells_of_column(sc)) { + for (auto c : subsurf_mesh.columns.getCells(sc)) { result_v[0][c] = region_model.second->RootingDepthFraction(z[0][c]); column_total += result_v[0][c] * cv[0][c]; } // normalize to 1 over the column if (column_total > 0) { - for (auto c : subsurf_mesh.cells_of_column(sc)) { + for (auto c : subsurf_mesh.columns.getCells(sc)) { result_v[0][c] = result_v[0][c] * 1.0 * surf_cv[0][sc] / column_total; } } @@ -124,7 +123,7 @@ RootingDepthFractionEvaluator::EnsureCompatibility_ToDeps_(State& S) CompositeVectorSpace dep_fac_one; dep_fac_one.SetMesh(S.GetMesh(domain)) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(z_key_, tag).Update(dep_fac_one); S.Require(cv_key_, tag).Update(dep_fac_one); @@ -132,7 +131,7 @@ RootingDepthFractionEvaluator::EnsureCompatibility_ToDeps_(State& S) CompositeVectorSpace surf_fac_one; surf_fac_one.SetMesh(S.GetMesh(Keys::getDomain(surf_cv_key_))) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(surf_cv_key_, tag).Update(surf_fac_one); } diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc index 10c35e22d..dc3812e51 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/seb_threecomponent_evaluator.cc @@ -254,15 +254,13 @@ SEBThreeComponentEvaluator::Evaluate_(const State& S, const std::vectorSetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + domain_fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_3; domain_fac_3.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 3); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 3); CompositeVectorSpace domain_fac_ss; domain_fac_ss.SetMesh(S.GetMesh(domain_ss_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_snow; domain_fac_snow.SetMesh(S.GetMesh(domain_snow_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); for (const auto& dep : dependencies_) { auto& fac = S.Require(dep.first, tag); @@ -682,17 +680,17 @@ SEBThreeComponentEvaluator::EnsureCompatibility_Structure_(State& S) CompositeVectorSpace domain_fac_owned; domain_fac_owned.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_snow; domain_fac_owned_snow.SetMesh(S.GetMesh(domain_snow_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_ss; domain_fac_owned_ss.SetMesh(S.GetMesh(domain_ss_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); for (const auto& key_tag : my_keys_) { if (Keys::getDomain(key_tag.first) == domain_) { diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/seb_twocomponent_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/seb_twocomponent_evaluator.cc index 05611ecd4..aa906fd87 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/seb_twocomponent_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/seb_twocomponent_evaluator.cc @@ -253,15 +253,13 @@ SEBTwoComponentEvaluator::Evaluate_(const State& S, const std::vectorSetGhosted()->AddComponent("cell", AmanziMesh::CELL, 1); + domain_fac.SetMesh(S.GetMesh(domain_))->SetGhosted()->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned; domain_fac_owned.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_ss; domain_fac_owned_ss.SetMesh(S.GetMesh(domain_ss_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_snow; domain_fac_owned_snow.SetMesh(S.GetMesh(domain_snow_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_2; domain_fac_2.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 2); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 2); CompositeVectorSpace domain_fac_ss; domain_fac_ss.SetMesh(S.GetMesh(domain_ss_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_snow; domain_fac_snow.SetMesh(S.GetMesh(domain_snow_)) ->SetGhosted() - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); for (auto& dep : dependencies_) { auto& fac = S.Require(dep.first, dep.second); @@ -639,17 +637,17 @@ SEBTwoComponentEvaluator::EnsureCompatibility_Structure_(State& S) CompositeVectorSpace domain_fac_owned; domain_fac_owned.SetMesh(S.GetMesh(domain_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_snow; domain_fac_owned_snow.SetMesh(S.GetMesh(domain_snow_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); CompositeVectorSpace domain_fac_owned_ss; domain_fac_owned_ss.SetMesh(S.GetMesh(domain_ss_)) ->SetGhosted() - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); for (const auto& key_tag : my_keys_) { if (Keys::getDomain(key_tag.first) == domain_) { diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/snow_meltrate_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/snow_meltrate_evaluator.cc index c67669652..ee1462071 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/snow_meltrate_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/snow_meltrate_evaluator.cc @@ -56,9 +56,8 @@ SnowMeltRateEvaluator::Evaluate_(const State& S, const std::vectorViewComponent("cell", false); for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { if (air_temp[0][c] - snow_temp_shift_ > 273.15) { @@ -90,9 +89,8 @@ SnowMeltRateEvaluator::EvaluatePartialDerivative_(const State& S, if (wrt_key == temp_key_) { for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { if (air_temp[0][c] - snow_temp_shift_ > 273.15) { res[0][c] = melt_rate_; @@ -107,9 +105,8 @@ SnowMeltRateEvaluator::EvaluatePartialDerivative_(const State& S, } else if (wrt_key == snow_key_) { for (const auto& lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - mesh->get_set_entities( - lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = mesh->getSetEntities( + lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); for (auto c : lc_ids) { if (swe[0][c] < lc.second.snow_transition_depth && air_temp[0][c] - snow_temp_shift_ > 273.15) { diff --git a/src/pks/surface_balance/constitutive_relations/land_cover/transpiration_distribution_evaluator.cc b/src/pks/surface_balance/constitutive_relations/land_cover/transpiration_distribution_evaluator.cc index df3355b0e..d8422eecc 100644 --- a/src/pks/surface_balance/constitutive_relations/land_cover/transpiration_distribution_evaluator.cc +++ b/src/pks/surface_balance/constitutive_relations/land_cover/transpiration_distribution_evaluator.cc @@ -109,9 +109,8 @@ TranspirationDistributionEvaluator::Evaluate_(const State& S, result_v.PutScalar(0.); for (const auto& region_lc : land_cover_) { - AmanziMesh::Entity_ID_List lc_ids; - surf_mesh.get_set_entities( - region_lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_type::OWNED, &lc_ids); + auto lc_ids = surf_mesh.getSetEntities( + region_lc.first, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); if (TranspirationPeriod_( S.get_time(), region_lc.second.leaf_on_doy, region_lc.second.leaf_off_doy)) { @@ -120,7 +119,7 @@ TranspirationDistributionEvaluator::Evaluate_(const State& S, double f_root_total = 0.; double f_wp_total = 0.; double var_dz = 0.; - for (auto c : subsurf_mesh.cells_of_column(sc)) { + for (auto c : subsurf_mesh.columns.getCells(sc)) { column_total += f_wp[0][c] * f_root[0][c] * cv[0][c]; result_v[0][c] = f_wp[0][c] * f_root[0][c]; if (f_wp[0][c] * f_root[0][c] > 0) var_dz += cv[0][c]; @@ -136,7 +135,7 @@ TranspirationDistributionEvaluator::Evaluate_(const State& S, coef *= limiting_factor; } - for (auto c : subsurf_mesh.cells_of_column(sc)) { + for (auto c : subsurf_mesh.columns.getCells(sc)) { result_v[0][c] *= coef; if (limiter_local_) { result_v[0][c] *= f_wp[0][c]; } } @@ -174,7 +173,7 @@ TranspirationDistributionEvaluator::EnsureCompatibility_ToDeps_(State& S) // Create an unowned factory to check my dependencies. // -- first those on the subsurface mesh CompositeVectorSpace dep_fac; - dep_fac.SetMesh(S.GetMesh(domain))->AddComponent("cell", AmanziMesh::CELL, 1); + dep_fac.SetMesh(S.GetMesh(domain))->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(f_root_key_, tag).Update(dep_fac); S.Require(f_wp_key_, tag).Update(dep_fac); S.Require(cv_key_, tag).Update(dep_fac); @@ -182,7 +181,7 @@ TranspirationDistributionEvaluator::EnsureCompatibility_ToDeps_(State& S) // -- next those on the surface mesh CompositeVectorSpace surf_fac; surf_fac.SetMesh(S.GetMesh(Keys::getDomain(surf_cv_key_))) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S.Require(potential_trans_key_, tag).Update(surf_fac); S.Require(surf_cv_key_, tag).Update(surf_fac); } diff --git a/src/pks/transport/sediment_transport/sediment_transport_pk.cc b/src/pks/transport/sediment_transport/sediment_transport_pk.cc index d7f918240..b16a2177b 100644 --- a/src/pks/transport/sediment_transport/sediment_transport_pk.cc +++ b/src/pks/transport/sediment_transport/sediment_transport_pk.cc @@ -130,7 +130,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) mesh_ = S->GetMesh(domain_name_); - dim = mesh_->space_dimension(); + dim = mesh_->getSpaceDimension(); // cross-coupling of PKs Teuchos::RCP physical_models = @@ -142,28 +142,28 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(flux_key_, tag_next_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S->RequireEvaluator(flux_key_, tag_next_); } S->Require(saturation_key_, tag_next_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(saturation_key_, tag_next_); // prev_sat does not have an evaluator, this is managed by hand. not sure why S->Require(saturation_key_, tag_current_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->GetRecordW(saturation_key_, tag_current_, passwd_).set_io_vis(false); if (!S->HasRecordSet(sd_organic_key_)) { S->Require(sd_organic_key_, tag_next_, sd_organic_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(sd_organic_key_, tag_next_); } @@ -171,7 +171,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(sd_trapping_key_, tag_next_, sd_trapping_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(sd_trapping_key_, tag_next_); } @@ -179,7 +179,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(sd_settling_key_, tag_next_, sd_settling_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(sd_settling_key_, tag_next_); } @@ -187,7 +187,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(sd_erosion_key_, tag_next_, sd_erosion_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(sd_erosion_key_, tag_next_); } @@ -196,7 +196,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) horiz_mixing_key_, tag_next_, horiz_mixing_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(horiz_mixing_key_, tag_next_); } @@ -204,7 +204,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(porosity_key_, tag_next_, porosity_key_) .SetMesh(mesh_) ->SetGhosted(false) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(porosity_key_, tag_next_); } @@ -218,7 +218,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(solid_residue_mass_key_, tag_next_, passwd_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, ncomponents); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, ncomponents); } if (!S->HasRecordSet(molar_density_key_)) { @@ -226,7 +226,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) molar_density_key_, tag_next_, molar_density_key_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); S->RequireEvaluator(molar_density_key_, tag_next_); } @@ -241,7 +241,7 @@ SedimentTransport_PK::Setup(const Teuchos::Ptr& S) S->Require(tcc_key_, tag_next_, passwd_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, ncomponents); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, ncomponents); } @@ -274,7 +274,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) vo_ = Teuchos::rcp(new VerboseObject("TransportPK", vlist)); Teuchos::OSTab tab = vo_->getOSTab(); - MyPID = mesh_->get_comm()->MyPID(); + MyPID = mesh_->getComm()->MyPID(); // // initialize missed fields InitializeFields_(S); @@ -294,12 +294,12 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) // Check input parameters. Due to limited amount of checks, we can do it earlier. // Policy(S.ptr()); - ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); - ncells_wghost = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::ALL); + ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); + ncells_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::ALL); - nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); - nfaces_wghost = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::ALL); - nnodes_wghost = mesh_->num_entities(AmanziMesh::NODE, AmanziMesh::Parallel_type::ALL); + nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); + nfaces_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::ALL); + nnodes_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::NODE, AmanziMesh::Parallel_kind::ALL); // extract control parameters InitializeAll_(); @@ -331,7 +331,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) // *tcc_tmp = *tcc; // upwind - const Epetra_Map& fmap_wghost = mesh_->face_map(true); + const Epetra_Map& fmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); upwind_cell_ = Teuchos::rcp(new Epetra_IntVector(fmap_wghost)); downwind_cell_ = Teuchos::rcp(new Epetra_IntVector(fmap_wghost)); @@ -340,10 +340,10 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) // advection block initialization current_component_ = -1; - const Epetra_Map& cmap_owned = mesh_->cell_map(false); + const Epetra_Map& cmap_owned = mesh_->getMap(AmanziMesh::Entity_kind::CELL,false); // reconstruction initialization - const Epetra_Map& cmap_wghost = mesh_->cell_map(true); + const Epetra_Map& cmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::CELL,true); lifting_ = Teuchos::rcp(new Operators::ReconstructionCellLinear(mesh_)); // create boundary conditions @@ -362,7 +362,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) std::string specname = it1->first; Teuchos::ParameterList& spec = bc_list.sublist(specname); Teuchos::RCP bc = - factory.Create(spec, "boundary concentration", AmanziMesh::FACE, Teuchos::null); + factory.Create(spec, "boundary concentration", AmanziMesh::Entity_kind::FACE, Teuchos::null); for (int i = 0; i < component_names_.size(); i++) { bc->tcc_names().push_back(component_names_[i]); @@ -382,7 +382,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) int gid = std::stoi(domain_name_.substr(last_of + 1, domain_name_.size())); spec.set("entity_gid_out", gid); Teuchos::RCP bc = - factory.Create(spec, "boundary concentration", AmanziMesh::FACE, Teuchos::null); + factory.Create(spec, "boundary concentration", AmanziMesh::Entity_kind::FACE, Teuchos::null); for (int i = 0; i < component_names_.size(); i++) { bc->tcc_names().push_back(component_names_[i]); @@ -399,7 +399,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) std::string specname = it1->first; Teuchos::ParameterList& spec = bc_list.sublist(specname); Teuchos::RCP bc = - factory.Create(spec, "boundary concentration", AmanziMesh::FACE, Teuchos::null); + factory.Create(spec, "boundary concentration", AmanziMesh::Entity_kind::FACE, Teuchos::null); std::vector& tcc_index = bc->tcc_index(); std::vector& tcc_names = bc->tcc_names(); @@ -443,7 +443,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) std::string specname = it1->first; Teuchos::ParameterList& spec = src_list.sublist(specname); Teuchos::RCP src = - factory.Create(spec, "sink", AmanziMesh::CELL, Teuchos::null); + factory.Create(spec, "sink", AmanziMesh::Entity_kind::CELL, Teuchos::null); for (int i = 0; i < component_names_.size(); i++) { src->tcc_names().push_back(component_names_[i]); @@ -458,7 +458,7 @@ SedimentTransport_PK::Initialize(const Teuchos::Ptr& S) std::string specname = it1->first; Teuchos::ParameterList& spec = src_list.sublist(specname); Teuchos::RCP src = - factory.Create(spec, "sink", AmanziMesh::CELL, Teuchos::null); + factory.Create(spec, "sink", AmanziMesh::Entity_kind::CELL, Teuchos::null); src->tcc_names().push_back(name); src->tcc_index().push_back(0); @@ -635,7 +635,7 @@ SedimentTransport_PK::StableTimeStep() outflux = total_outflux[c]; if ((outflux > 0) && ((*ws_prev_)[0][c] > 1e-6) && ((*ws_)[0][c] > 1e-6)) { - vol = mesh_->cell_volume(c); + vol = mesh_->getCellVolume(c); dt_cell = vol * (*mol_dens_)[0][c] * std::min((*ws_prev_)[0][c], (*ws_)[0][c]) / outflux; } if (dt_cell < dt_) { @@ -667,7 +667,7 @@ SedimentTransport_PK::StableTimeStep() // comm.MaxAll(&cmin_dt_tmp, &cmin_dt_unique, 1); // #endif // if (cmin_dt == cmin_dt_unique) { - // const AmanziGeometry::Point& p = mesh_->cell_centroid(cmin_dt); + // const AmanziGeometry::Point& p = mesh_->getCellCentroid(cmin_dt); // Teuchos::OSTab tab = vo_->getOSTab(); // *vo_->os() << "cell " << cmin_dt << " has smallest dt, (" << p[0] << ", " << p[1]; @@ -771,7 +771,7 @@ SedimentTransport_PK::AdvanceStep(double t_old, double t_new, bool reinit) for (int c = 0; c < ncells_owned; c++) { double vol_ws_den; - vol_ws_den = mesh_->cell_volume(c) * (*ws_prev_)[0][c] * (*mol_dens_)[0][c]; + vol_ws_den = mesh_->getCellVolume(c) * (*ws_prev_)[0][c] * (*mol_dens_)[0][c]; mass_sediment_stepstart_ = tcc_prev[0][c] * vol_ws_den; } @@ -881,7 +881,7 @@ SedimentTransport_PK ::Advance_Diffusion(double t_old, double t_new) tp_list_->sublist("operators").sublist("diffusion operator").sublist("matrix"); Teuchos::RCP bc_dummy = - Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::FACE, WhetStone::DOF_Type::SCALAR)); + Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::Entity_kind::FACE, WhetStone::DOF_Type::SCALAR)); // default boundary conditions (none inside domain and Neumann on its boundary) auto& bc_model = bc_dummy->bc_model(); @@ -893,7 +893,7 @@ SedimentTransport_PK ::Advance_Diffusion(double t_old, double t_new) op1->SetBCs(bc_dummy, bc_dummy); Teuchos::RCP op = op1->global_operator(); Teuchos::RCP op2 = - Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, op)); + Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, op)); const CompositeVectorSpace& cvs = op->DomainMap(); CompositeVector sol(cvs), factor(cvs), factor0(cvs), source(cvs), zero(cvs); @@ -996,7 +996,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) int num_advect = num_aqueous; for (int c = 0; c < ncells_owned; c++) { - vol_ws_den = mesh_->cell_volume(c) * (*ws_start)[0][c] * (*mol_dens_start)[0][c]; + vol_ws_den = mesh_->getCellVolume(c) * (*ws_start)[0][c] * (*mol_dens_start)[0][c]; for (int i = 0; i < num_advect; i++) { (*conserve_qty_)[i][c] = tcc_prev[i][c] * vol_ws_den; // if ((vol_ws_den > water_tolerance_) && ((*solid_qty_)[i][c] > 0 )){ // Desolve solid residual into liquid @@ -1009,7 +1009,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) } tmp1 = mass_start; - mesh_->get_comm()->SumAll(&tmp1, &mass_start, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_start, 1); if (vo_->getVerbLevel() >= Teuchos::VERB_HIGH) { if (domain_name_ == "surface") @@ -1081,7 +1081,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // recover concentration from new conservative state for (int c = 0; c < ncells_owned; c++) { - vol_ws_den = mesh_->cell_volume(c) * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; + vol_ws_den = mesh_->getCellVolume(c) * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; for (int i = 0; i < num_advect; i++) { if ((*ws_end)[0][c] > water_tolerance_ && (*conserve_qty_)[i][c] > 0) { tcc_next[i][c] = (*conserve_qty_)[i][c] / vol_ws_den; @@ -1099,7 +1099,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) } tmp1 = mass_final; - mesh_->get_comm()->SumAll(&tmp1, &mass_final, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_final, 1); // update mass balance @@ -1107,13 +1107,13 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) mass_sediment_exact_ += mass_sediment_source_ * dt_; if (vo_->getVerbLevel() >= Teuchos::VERB_HIGH) { tmp1 = mass_sediment_bc_; - mesh_->get_comm()->SumAll(&tmp1, &mass_sediment_bc_, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_sediment_bc_, 1); // *vo_->os() << "*****************\n"; // if (domain_name_ == "surface") *vo_->os()<<"Surface mass BC "<os() <<"Subsurface mass BC "<get_comm()->SumAll(&tmp1, &mass_sediment_source_, 1); + // mesh_->getComm()->SumAll(&tmp1, &mass_sediment_source_, 1); // if (domain_name_ == "surface") *vo_->os()<<"Surface mass_sediment source "<os() << "Subsurface mass_sediment source "<os() << "*****************\n"; @@ -1148,7 +1148,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // mass_sediment_source_.assign(num_aqueous + num_gaseous, 0.0); // // work memory -// const Epetra_Map& cmap_wghost = mesh_->cell_map(true); +// const Epetra_Map& cmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::CELL,true); // Epetra_Vector f_component(cmap_wghost); // // distribute vector of concentrations @@ -1159,9 +1159,9 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // Epetra_Vector ws_ratio(Copy, *ws_start, 0); // for (int c = 0; c < ncells_owned; c++){ -// double vol_phi_ws_den_end = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; +// double vol_phi_ws_den_end = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; // if (vol_phi_ws_den_end > water_tolerance_) { -// double vol_phi_ws_den_start = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_start)[0][c] * (*mol_dens_start)[0][c]; +// double vol_phi_ws_den_start = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_start)[0][c] * (*mol_dens_start)[0][c]; // if (vol_phi_ws_den_start > water_tolerance_){ // ws_ratio[c] = ( (*ws_start)[0][c] * (*mol_dens_start)[0][c] ) // / ( (*ws_end)[0][c] * (*mol_dens_end)[0][c] ); @@ -1187,7 +1187,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // tcc_next[i][c] = (tcc_prev[i][c] + dt_ * f_component[c]) * ws_ratio[c]; // if (tcc_next[i][c] < 0){ -// double vol_phi_ws_den = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; +// double vol_phi_ws_den = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; // (*solid_qty_)[i][c] += abs(tcc_next[i][c])*vol_phi_ws_den; // tcc_next[i][c] = 0.; // } @@ -1216,7 +1216,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // mass_sediment_source_.assign(num_aqueous + num_gaseous, 0.0); // // work memory -// const Epetra_Map& cmap_wghost = mesh_->cell_map(true); +// const Epetra_Map& cmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::CELL,true); // Epetra_Vector f_component(cmap_wghost);//, f_component2(cmap_wghost); // // distribute old vector of concentrations @@ -1273,7 +1273,7 @@ SedimentTransport_PK::AdvanceDonorUpwind(double dt_cycle) // double value = (tcc_prev[i][c] + dt_ * f_component[c]) * ws_ratio[c]; // tcc_next[i][c] = (tcc_next[i][c] + value) / 2; // if (tcc_next[i][c] < 0){ -// double vol_phi_ws_den = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; +// double vol_phi_ws_den = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_end)[0][c] * (*mol_dens_end)[0][c]; // (*solid_qty_)[i][c] += abs(tcc_next[i][c])*vol_phi_ws_den; // tcc_next[i][c] = 0.; // } @@ -1382,7 +1382,7 @@ SedimentTransport_PK::ComputeAddSourceTerms(double tp, for (int c = 0; c < ncells_owned; c++) { - double value = mesh_->cell_volume(c) * (Q_e[0][c] - Q_dt[0][c] - Q_ds[0][c]); + double value = mesh_->getCellVolume(c) * (Q_e[0][c] - Q_dt[0][c] - Q_ds[0][c]); tcc[0][c] += value * dtp; mass_sediment_source_ += value; dz[0][c] += ((1. / sediment_density_) * ((Q_dt[0][c] + Q_ds[0][c]) - Q_e[0][c]) + +Q_db[0][c]) * @@ -1412,7 +1412,7 @@ SedimentTransport_PK::ComputeAddSourceTerms(double tp, if (srcs_[m]->name() == "domain coupling") { value = values[k]; } else { - value = mesh_->cell_volume(c) * values[k]; + value = mesh_->getCellVolume(c) * values[k]; } //add_mass += dtp * value; @@ -1483,9 +1483,8 @@ SedimentTransport_PK::PopulateBoundaryData(std::vector& bc_model, bc_value[i] = 0.0; } - AmanziMesh::Entity_ID_List cells; for (int f = 0; f < nfaces_wghost; f++) { - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); if (cells.size() == 1) bc_model[f] = Operators::OPERATOR_BC_NEUMANN; } @@ -1523,11 +1522,9 @@ SedimentTransport_PK::IdentifyUpwindCells() (*upwind_cell_)[f] = -1; // negative value indicates boundary (*downwind_cell_)[f] = -1; } - AmanziMesh::Entity_ID_List faces; - std::vector dirs; for (int c = 0; c < ncells_wghost; c++) { - mesh_->cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh_->getCellFacesAndDirections(c); for (int i = 0; i < faces.size(); i++) { int f = faces[i]; @@ -1549,11 +1546,11 @@ SedimentTransport_PK::IdentifyUpwindCells() // Teuchos::RCP molar_density, // Teuchos::RCP& vol_darcy_flux){ -// int nfaces_wghost = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::ALL); +// int nfaces_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::ALL); // AmanziMesh::Entity_ID_List cells; // for (int f = 0; f < nfaces_wghost ; f++){ -// mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); +// auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); // double n_liq=0.; // for (int c=0; ccell_get_faces(c, &faces); + auto faces = mesh_->getCellFaces(c); int nfaces = faces.size(); std::vector flux(nfaces); @@ -90,18 +89,18 @@ Transport_ATS::CalculateDiffusionTensor_(double md, std::vector block; for (int r = 0; r < (spec->regions).size(); r++) { std::string region = (spec->regions)[r]; - mesh_->get_set_entities(region, AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED, &block); + auto block = mesh_->getSetEntities(region, AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); AmanziMesh::Entity_ID_List::iterator c; if (phase == TRANSPORT_PHASE_LIQUID) { - for (c = block.begin(); c != block.end(); c++) { - D_[*c] += - md * spec->tau[phase] * porosity[0][*c] * saturation[0][*c] * mol_density[0][*c]; + for (auto& c: block) { + D_[c] += + md * spec->tau[phase] * porosity[0][c] * saturation[0][c] * mol_density[0][c]; } } else if (phase == TRANSPORT_PHASE_GAS) { - for (c = block.begin(); c != block.end(); c++) { - D_[*c] += md * spec->tau[phase] * porosity[0][*c] * (1.0 - saturation[0][*c]) * - mol_density[0][*c]; + for (auto& c: block) { + D_[c] += md * spec->tau[phase] * porosity[0][c] * (1.0 - saturation[0][c]) * + mol_density[0][c]; } } } diff --git a/src/pks/transport/transport_ats_pk.cc b/src/pks/transport/transport_ats_pk.cc index cedc2942c..0157a711f 100644 --- a/src/pks/transport/transport_ats_pk.cc +++ b/src/pks/transport/transport_ats_pk.cc @@ -101,7 +101,7 @@ Transport_ATS::Transport_ATS(Teuchos::ParameterList& pk_tree, water_tolerance_ = plist_->get("water tolerance", 1e-6); dissolution_ = plist_->get("allow dissolution", false); max_tcc_ = plist_->get("maximum concentration", 0.9); - dim = mesh_->space_dimension(); + dim = mesh_->getSpaceDimension(); db_ = Teuchos::rcp(new Debugger(mesh_, name_, *plist_)); } @@ -169,13 +169,13 @@ Transport_ATS::Setup() requireAtNext(tcc_key_, tag_subcycle_next_, *S_, passwd_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, num_components); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, num_components); S_->GetRecordSetW(tcc_key_).set_subfieldnames(component_names_); requireAtCurrent(tcc_key_, tag_subcycle_current_, *S_, passwd_); // CellVolume is required here -- it may not be used in this PK, but having // it makes vis nicer - requireAtNext(cv_key_, tag_next_, *S_).SetMesh(mesh_)->AddComponent("cell", AmanziMesh::CELL, 1); + requireAtNext(cv_key_, tag_next_, *S_).SetMesh(mesh_)->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // Raw data, no evaluator? //std::vector primary_names(component_names_.begin(), component_names_.begin() + num_primary); @@ -184,7 +184,7 @@ Transport_ATS::Setup() requireAtNext(solid_residue_mass_key_, tag_subcycle_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, num_components); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_components); S_->GetRecordSetW(solid_residue_mass_key_).set_subfieldnames(primary_names); // This vector stores the conserved amount (in mols) of ncomponent @@ -202,7 +202,7 @@ Transport_ATS::Setup() requireAtNext(conserve_qty_key_, tag_subcycle_next_, *S_, name_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, num_components + 2); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, num_components + 2); S_->GetRecordSetW(conserve_qty_key_).set_subfieldnames(primary_names); // dependencies: @@ -211,7 +211,7 @@ Transport_ATS::Setup() if (abs_perm) { requireAtNext(permeability_key_, tag_next_, *S_) .SetMesh(mesh_) - ->AddComponent("cell", AmanziMesh::CELL, dim); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, dim); } // HACK ALERT -- FIXME --ETC @@ -230,14 +230,14 @@ Transport_ATS::Setup() requireAtNext(flux_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); S_->Require(flux_key_, tag_flux_next_ts_, name_); // -- water saturation requireAtNext(saturation_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); // Require a copy of saturation at the old time tag requireAtCurrent(saturation_key_, Tags::CURRENT, *S_); if (subcycling_) { @@ -251,12 +251,12 @@ Transport_ATS::Setup() requireAtNext(porosity_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtNext(molar_density_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); requireAtCurrent(molar_density_key_, Tags::CURRENT, *S_); if (subcycling_) { S_->Require( @@ -273,7 +273,7 @@ Transport_ATS::Setup() requireAtNext(water_src_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); has_water_src_key_ = true; water_src_in_meters_ = plist_->get("water source in meters", false); @@ -290,7 +290,7 @@ Transport_ATS::Setup() requireAtNext(geochem_src_factor_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } } @@ -299,7 +299,7 @@ Transport_ATS::Setup() requireAtNext(water_src_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, 1); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1); has_water_src_key_ = true; water_src_in_meters_ = plist_->get("water source in meters", false); } @@ -319,7 +319,7 @@ Transport_ATS::Setup() requireAtNext(solute_src_key_, Tags::NEXT, *S_) .SetMesh(mesh_) ->SetGhosted(true) - ->AddComponent("cell", AmanziMesh::CELL, num_components); + ->AddComponent("cell", AmanziMesh::Entity_kind::CELL, num_components); S_->Require( solute_src_key_, tag_next_, solute_src_key_); } @@ -361,7 +361,7 @@ Transport_ATS::Initialize() bc_scaling = 0.0; Teuchos::OSTab tab = vo_->getOSTab(); - MyPID = mesh_->get_comm()->MyPID(); + MyPID = mesh_->getComm()->MyPID(); // initialize missed fields InitializeFields_(); @@ -406,17 +406,17 @@ Transport_ATS::Initialize() // Check input parameters. Due to limited amount of checks, we can do it earlier. Policy(tag_next_); - ncells_owned = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::OWNED); - ncells_wghost = mesh_->num_entities(AmanziMesh::CELL, AmanziMesh::Parallel_type::ALL); - nfaces_owned = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED); - nfaces_wghost = mesh_->num_entities(AmanziMesh::FACE, AmanziMesh::Parallel_type::ALL); - nnodes_wghost = mesh_->num_entities(AmanziMesh::NODE, AmanziMesh::Parallel_type::ALL); + ncells_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::OWNED); + ncells_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::CELL, AmanziMesh::Parallel_kind::ALL); + nfaces_owned = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); + nfaces_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::ALL); + nnodes_wghost = mesh_->getNumEntities(AmanziMesh::Entity_kind::NODE, AmanziMesh::Parallel_kind::ALL); // extract control parameters InitializeAll_(); // upwind - const Epetra_Map& fmap_wghost = mesh_->face_map(true); + const Epetra_Map& fmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::FACE,true); upwind_cell_ = Teuchos::rcp(new Epetra_IntVector(fmap_wghost)); downwind_cell_ = Teuchos::rcp(new Epetra_IntVector(fmap_wghost)); IdentifyUpwindCells(); @@ -453,7 +453,7 @@ Transport_ATS::Initialize() // See amanzi ticket #646 -- this should probably be tag_subcycle_current_? // domain couplings are special -- they always work on all components Teuchos::RCP bc = - factory.Create(bc_list, "fields", AmanziMesh::FACE, Kxy, tag_current_); + factory.Create(bc_list, "fields", AmanziMesh::Entity_kind::FACE, Kxy, tag_current_); for (int i = 0; i < num_components; i++) { bc->tcc_names().push_back(component_names_[i]); @@ -472,7 +472,7 @@ Transport_ATS::Initialize() // See amanzi ticket #646 -- this should probably be tag_subcycle_current_? Teuchos::RCP bc = - factory.Create(bc_list, "boundary concentration", AmanziMesh::FACE, Kxy, tag_current_); + factory.Create(bc_list, "boundary concentration", AmanziMesh::Entity_kind::FACE, Kxy, tag_current_); for (int i = 0; i < num_components; i++) { bc->tcc_names().push_back(component_names_[i]); @@ -484,7 +484,7 @@ Transport_ATS::Initialize() } else { // See amanzi ticket #646 -- this should probably be tag_subcycle_current_? Teuchos::RCP bc = factory.Create( - bc_list, "boundary concentration function", AmanziMesh::FACE, Kxy, tag_current_); + bc_list, "boundary concentration function", AmanziMesh::Entity_kind::FACE, Kxy, tag_current_); bc->set_state(S_); std::vector tcc_names = @@ -552,7 +552,7 @@ Transport_ATS::Initialize() if (src_type == "domain coupling") { // domain couplings are special -- they always work on all components Teuchos::RCP src = - factory.Create(src_list, "fields", AmanziMesh::CELL, Kxy); + factory.Create(src_list, "fields", AmanziMesh::Entity_kind::CELL, Kxy); for (int i = 0; i < num_components; i++) { src->tcc_names().push_back(component_names_[i]); @@ -563,7 +563,7 @@ Transport_ATS::Initialize() } else if (src_type == "field") { // domain couplings are special -- they always work on all components Teuchos::RCP src = - factory.Create(src_list, "field", AmanziMesh::CELL, Kxy); + factory.Create(src_list, "field", AmanziMesh::Entity_kind::CELL, Kxy); for (int i = 0; i < component_names_.size(); i++) { src->tcc_names().push_back(component_names_[i]); @@ -574,7 +574,7 @@ Transport_ATS::Initialize() } else { // See amanzi ticket #646 -- this should probably be tag_subcycle_current_? Teuchos::RCP src = - factory.Create(src_list, "source function", AmanziMesh::CELL, Kxy, tag_current_); + factory.Create(src_list, "source function", AmanziMesh::Entity_kind::CELL, Kxy, tag_current_); std::vector tcc_names = src_list.get>("component names").toVector(); @@ -693,7 +693,7 @@ Transport_ATS::StableTimeStep() S_->Get(flux_key_, Tags::NEXT).ScatterMasterToGhosted("face"); flux_ = S_->Get(flux_key_, Tags::NEXT).ViewComponent("face", true); - Teuchos::RCP cell_map = Teuchos::rcp(new Epetra_Map(mesh_->cell_map(false))); + Teuchos::RCP cell_map = Teuchos::rcp(new Epetra_Map(mesh_->getMap(AmanziMesh::Entity_kind::CELL,false))); IdentifyUpwindCells(); tcc = S_->GetPtrW(tcc_key_, tag_current_, passwd_); @@ -720,7 +720,7 @@ Transport_ATS::StableTimeStep() double outflux = total_outflux[c]; if ((outflux > 0) && ((*ws_prev_)[0][c] > 0) && ((*ws_)[0][c] > 0) && ((*phi_)[0][c] > 0)) { - vol = mesh_->cell_volume(c); + vol = mesh_->getCellVolume(c); dt_cell = vol * (*mol_dens_)[0][c] * (*phi_)[0][c] * std::min((*ws_prev_)[0][c], (*ws_)[0][c]) / outflux; } @@ -753,7 +753,7 @@ Transport_ATS::StableTimeStep() double tmp_package[6]; if (cell_map->GID(cmin_dt) == cmin_dt_unique) { - const AmanziGeometry::Point& p = mesh_->cell_centroid(cmin_dt); + const AmanziGeometry::Point& p = mesh_->getCellCentroid(cmin_dt); min_pid = comm.MyPID(); tmp_package[0] = ws_min_dt; @@ -938,7 +938,7 @@ Transport_ATS::AdvanceStep(double t_old, double t_new, bool reinit) for (int c = 0; c < ncells_owned; c++) { double vol_phi_ws_den; vol_phi_ws_den = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_prev_)[0][c] * (*mol_dens_prev_)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_prev_)[0][c] * (*mol_dens_prev_)[0][c]; for (int i = 0; i < num_aqueous + num_gaseous; i++) { mass_solutes_stepstart_[i] = tcc_prev[i][c] * vol_phi_ws_den; } @@ -1056,7 +1056,7 @@ Transport_ATS ::Advance_Dispersion_Diffusion(double t_old, double t_new) if (flag_dispersion_ || flag_diffusion) { // default boundary conditions (none inside domain and Neumann on its boundary) Teuchos::RCP bc_dummy = - Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::FACE, WhetStone::DOF_Type::SCALAR)); + Teuchos::rcp(new Operators::BCs(mesh_, AmanziMesh::Entity_kind::FACE, WhetStone::DOF_Type::SCALAR)); auto& bc_model = bc_dummy->bc_model(); auto& bc_value = bc_dummy->bc_value(); PopulateBoundaryData(bc_model, bc_value, -1); @@ -1070,7 +1070,7 @@ Transport_ATS ::Advance_Dispersion_Diffusion(double t_old, double t_new) op1->SetBCs(bc_dummy, bc_dummy); Teuchos::RCP op = op1->global_operator(); Teuchos::RCP op2 = - Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::CELL, op)); + Teuchos::rcp(new Operators::PDE_Accumulation(AmanziMesh::Entity_kind::CELL, op)); const CompositeVectorSpace& cvs = op1->global_operator()->DomainMap(); CompositeVector sol(cvs), factor(cvs), factor0(cvs), source(cvs), zero(cvs); @@ -1117,7 +1117,7 @@ Transport_ATS ::Advance_Dispersion_Diffusion(double t_old, double t_new) Epetra_MultiVector& rhs_cell = *op->rhs()->ViewComponent("cell"); for (int c = 0; c < ncells_owned; c++) { double tmp = - mesh_->cell_volume(c) * (*ws_)[0][c] * (*phi_)[0][c] * (*mol_dens_)[0][c] / dt_MPC; + mesh_->getCellVolume(c) * (*ws_)[0][c] * (*phi_)[0][c] * (*mol_dens_)[0][c] / dt_MPC; rhs_cell[0][c] = tcc_next[i][c] * tmp; } } @@ -1139,8 +1139,8 @@ Transport_ATS ::Advance_Dispersion_Diffusion(double t_old, double t_new) if (tcc_tmp->HasComponent("boundary_face")) { Epetra_MultiVector& tcc_tmp_bf = *tcc_tmp->ViewComponent("boundary_face", false); Epetra_MultiVector& sol_faces = *sol.ViewComponent("face", false); - const Epetra_Map& vandalay_map = mesh_->exterior_face_map(false); - const Epetra_Map& face_map = mesh_->face_map(false); + const Epetra_Map& vandalay_map = mesh_->getMap(AmanziMesh::Entity_kind::BOUNDARY_FACE,false); + const Epetra_Map& face_map = mesh_->getMap(AmanziMesh::Entity_kind::FACE,false); int nbfaces = tcc_tmp_bf.MyLength(); for (int bf = 0; bf != nbfaces; ++bf) { AmanziMesh::Entity_ID f = face_map.LID(vandalay_map.GID(bf)); @@ -1260,7 +1260,7 @@ Transport_ATS::AdvanceDonorUpwind(double dt_cycle) for (int c = 0; c < ncells_owned; c++) { double vol_phi_ws_den = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; (*conserve_qty_)[num_components + 1][c] = vol_phi_ws_den; for (int i = 0; i < num_advect; i++) { @@ -1282,7 +1282,7 @@ Transport_ATS::AdvanceDonorUpwind(double dt_cycle) db_->WriteCellVector("cons (start)", *conserve_qty_); tmp1 = mass_current; - mesh_->get_comm()->SumAll(&tmp1, &mass_current, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_current, 1); // advance all components at once for (int f = 0; f < nfaces_wghost; f++) { // loop over master and slave faces @@ -1303,7 +1303,7 @@ Transport_ATS::AdvanceDonorUpwind(double dt_cycle) double tcc_flux = dt_ * u * tcc_prev[i][c1]; (*conserve_qty_)[i][c1] -= tcc_flux; if (c2 < 0) mass_solutes_bc_[i] -= tcc_flux; - //AmanziGeometry::Point normal = mesh_->face_normal(f); + //AmanziGeometry::Point normal = mesh_->getFaceNormal(f); } (*conserve_qty_)[num_components + 1][c1] -= dt_ * u; @@ -1367,7 +1367,7 @@ Transport_ATS::AdvanceDonorUpwind(double dt_cycle) // recover concentration from new conservative state for (int c = 0; c < ncells_owned; c++) { double water_new = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; double water_sink = (*conserve_qty_)[num_components] [c]; // water at the new time + outgoing domain coupling source @@ -1409,7 +1409,7 @@ Transport_ATS::AdvanceDonorUpwind(double dt_cycle) } tmp1 = mass_final; - mesh_->get_comm()->SumAll(&tmp1, &mass_final, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_final, 1); // update mass balance for (int i = 0; i < mass_solutes_exact_.size(); i++) { @@ -1433,7 +1433,7 @@ Transport_ATS::AdvanceSecondOrderUpwindRK1(double dt_cycle) mass_solutes_source_.assign(num_aqueous + num_gaseous, 0.0); // work memory - const Epetra_Map& cmap_wghost = mesh_->cell_map(true); + const Epetra_Map& cmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::CELL,true); // distribute vector of concentrations tcc->ScatterMasterToGhosted("cell"); @@ -1442,9 +1442,9 @@ Transport_ATS::AdvanceSecondOrderUpwindRK1(double dt_cycle) // Epetra_Vector ws_ratio(Copy, *ws_current, 0); // for (int c = 0; c < ncells_owned; c++) { - // double vol_phi_ws_den_next = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; + // double vol_phi_ws_den_next = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; // if (vol_phi_ws_den_next > water_tolerance_) { - // double vol_phi_ws_den_current = mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; + // double vol_phi_ws_den_current = mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; // if (vol_phi_ws_den_current > water_tolerance_) { // ws_ratio[c] = ( (*ws_current)[0][c] * (*mol_dens_current)[0][c] ) // / ( (*ws_next)[0][c] * (*mol_dens_next)[0][c] ); @@ -1462,7 +1462,7 @@ Transport_ATS::AdvanceSecondOrderUpwindRK1(double dt_cycle) // prepopulate with initial water for better debugging for (int c = 0; c < ncells_owned; c++) { double vol_phi_ws_den_current = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; (*conserve_qty_)[num_components + 1][c] = vol_phi_ws_den_current; } @@ -1478,7 +1478,7 @@ Transport_ATS::AdvanceSecondOrderUpwindRK1(double dt_cycle) for (int c = 0; c < ncells_owned; c++) { double water_old = (*conserve_qty_)[num_components + 1][c]; double water_new = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; double water_sink = (*conserve_qty_)[num_components][c]; double water_total = water_sink + water_new; (*conserve_qty_)[num_components][c] = water_total; @@ -1524,7 +1524,7 @@ Transport_ATS::AdvanceSecondOrderUpwindRK2(double dt_cycle) mass_solutes_source_.assign(num_aqueous + num_gaseous, 0.0); // work memory - const Epetra_Map& cmap_wghost = mesh_->cell_map(true); + const Epetra_Map& cmap_wghost = mesh_->getMap(AmanziMesh::Entity_kind::CELL,true); Epetra_Vector f_component(cmap_wghost); //, f_component2(cmap_wghost); // distribute old vector of concentrations @@ -1573,7 +1573,7 @@ Transport_ATS::AdvanceSecondOrderUpwindRK2(double dt_cycle) tcc_next[i][c] = (tcc_next[i][c] + value) / 2; if (tcc_next[i][c] < 0) { double vol_phi_ws_den = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; (*solid_qty_)[i][c] += abs(tcc_next[i][c]) * vol_phi_ws_den; tcc_next[i][c] = 0.; } @@ -1626,7 +1626,7 @@ Transport_ATS::ComputeAddSourceTerms(double tp, int imap = i; if (num_vectors == 1) imap = 0; - double value = mesh_->cell_volume(c) * values[k]; + double value = mesh_->getCellVolume(c) * values[k]; cons_qty[imap][c] += dtp * value; mass_solutes_source_[i] += value; } @@ -1698,9 +1698,8 @@ Transport_ATS::PopulateBoundaryData(std::vector& bc_model, bc_value[i] = 0.0; } - AmanziMesh::Entity_ID_List cells; for (int f = 0; f < nfaces_wghost; f++) { - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); if (cells.size() == 1) bc_model[f] = Operators::OPERATOR_BC_NEUMANN; } @@ -1738,10 +1737,8 @@ Transport_ATS::IdentifyUpwindCells() (*downwind_cell_)[f] = -1; } - AmanziMesh::Entity_ID_List faces; - std::vector dirs; for (int c = 0; c < ncells_wghost; c++) { - mesh_->cell_get_faces_and_dirs(c, &faces, &dirs); + const auto& [faces, dirs] = mesh_->getCellFacesAndDirections(c); for (int i = 0; i < faces.size(); i++) { int f = faces[i]; @@ -1765,10 +1762,8 @@ Transport_ATS::ComputeVolumeDarcyFlux(Teuchos::RCP flu Teuchos::RCP molar_density, Teuchos::RCP& vol_darcy_flux) { - AmanziMesh::Entity_ID_List cells; - for (int f = 0; f < nfaces_wghost; f++) { - mesh_->face_get_cells(f, AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, AmanziMesh::Parallel_kind::ALL); double n_liq = 0.; for (int c = 0; c < cells.size(); c++) n_liq += (*molar_density)[0][c]; n_liq /= cells.size(); diff --git a/src/pks/transport/transport_ats_ti.cc b/src/pks/transport/transport_ats_ti.cc index 41ac245a0..473aab92f 100644 --- a/src/pks/transport/transport_ats_ti.cc +++ b/src/pks/transport/transport_ats_ti.cc @@ -84,7 +84,7 @@ Transport_ATS::FunctionalTimeDerivative(double t, } double u = fabs((*flux_)[0][f]); - const AmanziGeometry::Point& xf = mesh_->face_centroid(f); + const AmanziGeometry::Point& xf = mesh_->getFaceCentroid(f); double upwind_tcc, tcc_flux; if (c1 >= 0 && c1 < ncells_owned && c2 >= 0 && c2 < ncells_owned) { @@ -130,10 +130,10 @@ Transport_ATS::FunctionalTimeDerivative(double t, for (int c = 0; c < ncells_owned; c++) { // calculate conservative quantatity double vol_phi_ws_den = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_current)[0][c] * (*mol_dens_current)[0][c]; if ((*ws_current)[0][c] < 1e-12) vol_phi_ws_den = - mesh_->cell_volume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; + mesh_->getCellVolume(c) * (*phi_)[0][c] * (*ws_next)[0][c] * (*mol_dens_next)[0][c]; if (vol_phi_ws_den > water_tolerance_) { f_component[c] /= vol_phi_ws_den; } } @@ -152,10 +152,10 @@ Transport_ATS::FunctionalTimeDerivative(double t, if (c2 >= 0 && f < nfaces_owned) { double u = fabs((*flux_)[0][f]); - double vol_phi_ws_den = mesh_->cell_volume(c2) * (*phi_)[0][c2] * (*ws_current)[0][c2] * + double vol_phi_ws_den = mesh_->getCellVolume(c2) * (*phi_)[0][c2] * (*ws_current)[0][c2] * (*mol_dens_current)[0][c2]; if ((*ws_current)[0][c2] < 1e-12) - vol_phi_ws_den = mesh_->cell_volume(c2) * (*phi_)[0][c2] * (*ws_next)[0][c2] * + vol_phi_ws_den = mesh_->getCellVolume(c2) * (*phi_)[0][c2] * (*ws_next)[0][c2] * (*mol_dens_next)[0][c2]; double tcc_flux = u * values[i]; diff --git a/src/pks/transport/transport_ats_vandv.cc b/src/pks/transport/transport_ats_vandv.cc index 3b60d9141..7c6bc3742 100644 --- a/src/pks/transport/transport_ats_vandv.cc +++ b/src/pks/transport/transport_ats_vandv.cc @@ -39,21 +39,21 @@ Transport_ATS::CreateDefaultState(Teuchos::RCP& mesh, in S_->Require(saturation_key_, Tags::NEXT, name) .SetMesh(mesh) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } if (!S_->HasRecord(saturation_key_, Tags::CURRENT)) { S_->Require(saturation_key_, Tags::CURRENT, name) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, 1); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, 1); } if (!S_->HasRecord(flux_key_, Tags::NEXT)) { S_->Require(flux_key_, Tags::NEXT, name) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("face", AmanziMesh::FACE, 1); + ->SetComponent("face", AmanziMesh::Entity_kind::FACE, 1); } if (!S_->HasRecord(tcc_key_, Tags::NEXT)) { @@ -62,7 +62,7 @@ Transport_ATS::CreateDefaultState(Teuchos::RCP& mesh, in S_->Require(tcc_key_, Tags::NEXT, name) .SetMesh(mesh_) ->SetGhosted(true) - ->SetComponent("cell", AmanziMesh::CELL, ncomponents); + ->SetComponent("cell", AmanziMesh::Entity_kind::CELL, ncomponents); S_->GetRecordSetW(tcc_key_).set_subfieldnames(subfield_names); } @@ -95,7 +95,7 @@ Transport_ATS::CreateDefaultState(Teuchos::RCP& mesh, in void Transport_ATS::Policy(const Tag& tag) { - if (mesh_->get_comm()->NumProc() > 1) { + if (mesh_->getComm()->NumProc() > 1) { if (!S_->Get(tcc_key_, tag).Ghosted()) { Errors::Message msg; msg << "Field \"total component concentration\" has no ghost values." @@ -130,21 +130,19 @@ Transport_ATS::VV_PrintSoluteExtrema(const Epetra_MultiVector& tcc_next, double bool flag(false); for (int k = 0; k < nregions; k++) { - if (mesh_->valid_set_name(runtime_regions_[k], AmanziMesh::FACE)) { + if (mesh_->isValidSetName(runtime_regions_[k], AmanziMesh::Entity_kind::FACE)) { flag = true; - AmanziMesh::Entity_ID_List block; - mesh_->get_set_entities( - runtime_regions_[k], AmanziMesh::FACE, AmanziMesh::Parallel_type::OWNED, &block); + auto block = mesh_->getSetEntities( + runtime_regions_[k], AmanziMesh::Entity_kind::FACE, AmanziMesh::Parallel_kind::OWNED); int nblock = block.size(); for (int m = 0; m < nblock; m++) { int f = block[m]; - Amanzi::AmanziMesh::Entity_ID_List cells; - mesh_->face_get_cells(f, Amanzi::AmanziMesh::Parallel_type::ALL, &cells); + auto cells = mesh_->getFaceCells(f, Amanzi::AmanziMesh::Parallel_kind::ALL); int dir, c = cells[0]; - const AmanziGeometry::Point& normal = mesh_->face_normal(f, false, c, &dir); + const AmanziGeometry::Point& normal = mesh_->getFaceNormal(f, c, &dir); double u = (*flux_)[0][f] * dir; if (u > 0) solute_flux += u * tcc_next[i][c]; } @@ -154,7 +152,7 @@ Transport_ATS::VV_PrintSoluteExtrema(const Epetra_MultiVector& tcc_next, double //solute_flux *= units_.concentration_factor(); double tmp = solute_flux; - mesh_->get_comm()->SumAll(&tmp, &solute_flux, 1); + mesh_->getComm()->SumAll(&tmp, &solute_flux, 1); double ws_min, ws_max; ws_->MinValue(&ws_min); @@ -168,7 +166,7 @@ Transport_ATS::VV_PrintSoluteExtrema(const Epetra_MultiVector& tcc_next, double //mass_solutes_exact_[i] += VV_SoluteVolumeChangePerSecond(i) * dT_MPC; double mass_solute(0.0); for (int c = 0; c < ncells_owned; c++) { - double vol = mesh_->cell_volume(c); + double vol = mesh_->getCellVolume(c); mass_solute += (*ws_)[0][c] * (*phi_)[0][c] * tcc_next[i][c] * vol * (*mol_dens_)[0][c]; } // mass_solute /= units_.concentration_factor(); @@ -178,10 +176,10 @@ Transport_ATS::VV_PrintSoluteExtrema(const Epetra_MultiVector& tcc_next, double double tmp1 = mass_solute, tmp2 = mass_solutes_exact_[i], mass_exact; double tmp_start = mass_solutes_stepstart_[i]; double tmp_bc = mass_solutes_bc_[i]; - mesh_->get_comm()->SumAll(&tmp1, &mass_solute, 1); - mesh_->get_comm()->SumAll(&tmp2, &mass_exact, 1); - mesh_->get_comm()->SumAll(&tmp_start, &(mass_solutes_stepstart_[i]), 1); - mesh_->get_comm()->SumAll(&tmp_bc, &(mass_solutes_bc_[i]), 1); + mesh_->getComm()->SumAll(&tmp1, &mass_solute, 1); + mesh_->getComm()->SumAll(&tmp2, &mass_exact, 1); + mesh_->getComm()->SumAll(&tmp_start, &(mass_solutes_stepstart_[i]), 1); + mesh_->getComm()->SumAll(&tmp_bc, &(mass_solutes_bc_[i]), 1); } } @@ -285,7 +283,7 @@ Transport_ATS::VV_CheckTracerBounds(Epetra_MultiVector& tracer, std::cout << " component = " << component << std::endl; std::cout << " simulation time = " << t_physics_ << std::endl; std::cout << " cell = " << c << std::endl; - std::cout << " center = " << mesh_->cell_centroid(c) << std::endl; + std::cout << " center = " << mesh_->getCellCentroid(c) << std::endl; std::cout << " value (old) = " << tcc_prev[component][c] << std::endl; std::cout << " value (new) = " << value << std::endl; @@ -342,10 +340,10 @@ Transport_ATS::CalculateLpErrors(AnalyticFunction f, { *L1 = *L2 = 0.0; for (int c = 0; c < sol->MyLength(); c++) { - const AmanziGeometry::Point& xc = mesh_->cell_centroid(c); + const AmanziGeometry::Point& xc = mesh_->getCellCentroid(c); double d = (*sol)[c] - f(xc, t); - double volume = mesh_->cell_volume(c); + double volume = mesh_->getCellVolume(c); *L1 += fabs(d) * volume; *L2 += d * d * volume; } @@ -359,14 +357,14 @@ Transport_ATS::ComputeSolute(const Epetra_MultiVector& tcc_c, int i) { double mass_solute(0.0); for (int c = 0; c < ncells_owned; c++) { - double vol = mesh_->cell_volume(c); + double vol = mesh_->getCellVolume(c); mass_solute += (*ws_next)[0][c] * (*phi_)[0][c] * tcc_c[i][c] * vol * (*mol_dens_next)[0][c] + (*solid_qty_)[i][c]; } //mass_solute /= units_.concentration_factor(); double tmp1 = mass_solute; - mesh_->get_comm()->SumAll(&tmp1, &mass_solute, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_solute, 1); return mass_solute; } @@ -380,13 +378,13 @@ Transport_ATS::ComputeSolute(const Epetra_MultiVector& tcc_c, { double mass_solute(0.0); for (int c = 0; c < ncells_owned; c++) { - double vol = mesh_->cell_volume(c); + double vol = mesh_->getCellVolume(c); mass_solute += ws[0][c] * (*phi_)[0][c] * tcc_c[i][c] * vol * den[0][c] + (*solid_qty_)[i][c]; } //mass_solute /= units_.concentration_factor(); double tmp1 = mass_solute; - mesh_->get_comm()->SumAll(&tmp1, &mass_solute, 1); + mesh_->getComm()->SumAll(&tmp1, &mass_solute, 1); return mass_solute; }