MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / findCouples

Function findCouples

src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C:859–930  ·  view source on GitHub ↗

Find cells on mesh whose faceID/procID match the neighbour cell/proc of domainMesh. Store the matching face.

Source from the content-addressed store, hash-verified

857// Find cells on mesh whose faceID/procID match the neighbour cell/proc of
858// domainMesh. Store the matching face.
859void Foam::fvMeshDistribute::findCouples
860(
861 const primitiveMesh& mesh,
862 const labelList& sourceFace,
863 const labelList& sourceProc,
864 const labelList& sourcePatch,
865
866 const label domain,
867 const primitiveMesh& domainMesh,
868 const labelList& domainFace,
869 const labelList& domainProc,
870 const labelList& domainPatch,
871
872 labelList& masterCoupledFaces,
873 labelList& slaveCoupledFaces
874)
875{
876 // Store domain neighbour as map so we can easily look for pair
877 // with same face+proc.
878 HashTable<label, labelPair, labelPair::Hash<>> map(domainFace.size());
879
880 forAll(domainProc, bFacei)
881 {
882 if (domainProc[bFacei] != -1 && domainPatch[bFacei] == -1)
883 {
884 map.insert
885 (
886 labelPair(domainFace[bFacei], domainProc[bFacei]),
887 bFacei
888 );
889 }
890 }
891
892
893 // Try to match mesh data.
894
895 masterCoupledFaces.setSize(domainFace.size());
896 slaveCoupledFaces.setSize(domainFace.size());
897 label coupledI = 0;
898
899 forAll(sourceFace, bFacei)
900 {
901 if (sourceProc[bFacei] != -1 && sourcePatch[bFacei] == -1)
902 {
903 labelPair myData(sourceFace[bFacei], sourceProc[bFacei]);
904
905 HashTable<label, labelPair, labelPair::Hash<>>::const_iterator
906 iter = map.find(myData);
907
908 if (iter != map.end())
909 {
910 label nbrBFacei = iter();
911
912 masterCoupledFaces[coupledI] = mesh.nInternalFaces() + bFacei;
913 slaveCoupledFaces[coupledI] =
914 domainMesh.nInternalFaces()
915 + nbrBFacei;
916

Callers 1

fvMeshDistribute.CFile · 0.85

Calls 6

forAllFunction · 0.50
sizeMethod · 0.45
insertMethod · 0.45
setSizeMethod · 0.45
endMethod · 0.45
nInternalFacesMethod · 0.45

Tested by

no test coverage detected