topology.cpp serif/backend/mfem/discretization/topology.hpp utility vector mfem/mesh/mesh.hpp serif serif::backend serif::backend::mfem serif::backend::mfem::discretization #include"serif/backend/mfem/discretization/topology.hpp" #include<utility> #include<vector> #include"mfem/mesh/mesh.hpp" namespaceserif::backend::mfem::discretization{ ::serif::discretization::domain::mesh::MeshTopologymake_mesh_topology(const::mfem::Mesh&mesh){ usingnamespace::serif::discretization::domain::mesh; MeshTopologyDatadata; data.elementDomainIDs.resize(mesh.GetNE()); std::vector<int>active_faces(mesh.GetNumFaces(),-1); data.boundaryElementBoundaryIDs.resize(mesh.GetNBE()); data.boundaryElementFaceIDs.resize(mesh.GetNBE()); for(intelementID=0;elementID<mesh.GetNE();++elementID){ data.elementDomainIDs[elementID]=mesh.GetAttribute(elementID); } for(intfaceID=0;faceID<mesh.GetNumFaces();++faceID){ if(mesh.Nonconforming()&&mesh.GetFaceInformation(faceID).tag==::mfem::Mesh::FaceInfoTag::MasterNonconforming){ //Finefacesdescribetheactualadjacency.Thecoarsebookkeepingfaceisnotexterior. continue; } active_faces[faceID]=static_cast<int>(data.faceElements.size()); data.faceElements.emplace_back(); mesh.GetFaceElements(faceID,&data.faceElements.back().firstElementID,&data.faceElements.back().secondElementID); } for(intboundaryElementID=0;boundaryElementID<mesh.GetNBE();++boundaryElementID){ data.boundaryElementBoundaryIDs[boundaryElementID]=mesh.GetBdrAttribute(boundaryElementID); data.boundaryElementFaceIDs[boundaryElementID]=active_faces[mesh.GetBdrElementFaceIndex(boundaryElementID)]; } returnMeshTopology(std::move(data)); } }