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

Function cullPoints

src/conversion/meshReader/starcd/STARCDMeshReader.C:980–1035  ·  view source on GitHub ↗

remove unused points

Source from the content-addressed store, hash-verified

978// remove unused points
979//
980void Foam::meshReaders::STARCD::cullPoints()
981{
982 label nPoints = points_.size();
983 labelList oldToNew(nPoints, -1);
984
985 // loop through cell faces and note which points are being used
986 forAll(cellFaces_, celli)
987 {
988 const faceList& faces = cellFaces_[celli];
989 forAll(faces, i)
990 {
991 const labelList& labels = faces[i];
992 forAll(labels, j)
993 {
994 oldToNew[labels[j]]++;
995 }
996 }
997 }
998
999 // the new ordering and the count of unused points
1000 label pointi = 0;
1001 forAll(oldToNew, i)
1002 {
1003 if (oldToNew[i] >= 0)
1004 {
1005 oldToNew[i] = pointi++;
1006 }
1007 }
1008
1009 // report unused points
1010 if (nPoints > pointi)
1011 {
1012 Info<< "Unused points = " << (nPoints - pointi) << endl;
1013 nPoints = pointi;
1014
1015 // adjust points and truncate
1016 inplaceReorder(oldToNew, points_);
1017 points_.setSize(nPoints);
1018
1019 // adjust cellFaces - with mesh shapes this might be faster
1020 forAll(cellFaces_, celli)
1021 {
1022 faceList& faces = cellFaces_[celli];
1023 forAll(faces, i)
1024 {
1025 inplaceRenumber(oldToNew, faces[i]);
1026 }
1027 }
1028
1029 // adjust baffles
1030 forAll(baffleFaces_, facei)
1031 {
1032 inplaceRenumber(oldToNew, baffleFaces_[facei]);
1033 }
1034 }
1035}
1036
1037

Callers 1

readGeometryFunction · 0.85

Calls 3

forAllFunction · 0.50
sizeMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected