attachDetachPointMatchMap.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "attachDetach.H"
00028 #include "polyMesh.H"
00029 #include "primitiveMesh.H"
00030 #include "primitiveFacePatch.H"
00031 #include "polyTopoChanger.H"
00032
00033
00034
00035 const Foam::Map<Foam::label>&
00036 Foam::attachDetach::pointMatchMap() const
00037 {
00038 if (!pointMatchMapPtr_)
00039 {
00040 calcPointMatchMap();
00041 }
00042
00043 return *pointMatchMapPtr_;
00044 }
00045
00046
00047 void Foam::attachDetach::calcPointMatchMap() const
00048 {
00049 if (debug)
00050 {
00051 Pout<< "void attachDetach::calcPointMatchMap() const "
00052 << " for object " << name() << " : "
00053 << "Calculating point matching" << endl;
00054 }
00055
00056 if (pointMatchMapPtr_)
00057 {
00058 FatalErrorIn
00059 (
00060 "void attachDetach::calcPointMatchMap() const"
00061 ) << "Point match map already calculated for object " << name()
00062 << abort(FatalError);
00063 }
00064
00065 const polyMesh& mesh = topoChanger().mesh();
00066 const faceList& faces = mesh.faces();
00067
00068 const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchID_.index()];
00069 const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchID_.index()];
00070
00071
00072 primitiveFacePatch reverseSlavePatch
00073 (
00074 faceList(slavePatch.size()),
00075 mesh.points()
00076 );
00077
00078 const label slavePatchStart = slavePatch.start();
00079
00080 forAll (reverseSlavePatch, faceI)
00081 {
00082 reverseSlavePatch[faceI] =
00083 faces[slavePatchStart + faceI].reverseFace();
00084 }
00085
00086
00087 const labelList& masterMeshPoints = masterPatch.meshPoints();
00088 const labelList& slaveMeshPoints = reverseSlavePatch.meshPoints();
00089
00090 const faceList& masterLocalFaces = masterPatch.localFaces();
00091 const faceList& slaveLocalFaces = reverseSlavePatch.localFaces();
00092
00093 pointMatchMapPtr_ = new Map<label>(2*slaveMeshPoints.size());
00094 Map<label>& removedPointMap = *pointMatchMapPtr_;
00095
00096 forAll (masterLocalFaces, faceI)
00097 {
00098 const face& curMasterPoints = masterLocalFaces[faceI];
00099 const face& curSlavePoints = slaveLocalFaces[faceI];
00100
00101 forAll (curMasterPoints, pointI)
00102 {
00103
00104
00105
00106 if
00107 (
00108 masterMeshPoints[curMasterPoints[pointI]]
00109 != slaveMeshPoints[curSlavePoints[pointI]]
00110 )
00111 {
00112
00113
00114
00115 removedPointMap.insert
00116 (
00117 slaveMeshPoints[curSlavePoints[pointI]],
00118 masterMeshPoints[curMasterPoints[pointI]]
00119 );
00120 }
00121 }
00122 }
00123
00124 if (debug)
00125 {
00126 Pout<< "void attachDetach::calcPointMatchMap() const "
00127 << " for object " << name() << " : "
00128 << "Finished calculating point matching" << endl;
00129 }
00130 }
00131
00132
00133
Copyright © 2000-2009 OpenCFD Ltd