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
00028
00029 #include "blockMesh.H"
00030
00031
00032
00033 Foam::faceList Foam::blockMesh::createPatchFaces
00034 (
00035 const polyPatch& patchTopologyFaces
00036 )
00037 {
00038 blockMesh& blocks = *this;
00039
00040 labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
00041
00042 label nFaces=0;
00043
00044 forAll(patchTopologyFaces, patchTopologyFaceLabel)
00045 {
00046 label blockLabel = blockLabels[patchTopologyFaceLabel];
00047
00048 faceList blockFaces
00049 (
00050 blocks[blockLabel].blockDef().blockShape().faces()
00051 );
00052
00053 forAll(blockFaces, blockFaceLabel)
00054 {
00055 if
00056 (
00057 blockFaces[blockFaceLabel]
00058 == patchTopologyFaces[patchTopologyFaceLabel]
00059 )
00060 {
00061 nFaces +=
00062 blocks[blockLabel].boundaryPatches()[blockFaceLabel].size();
00063 }
00064 }
00065 }
00066
00067
00068 faceList patchFaces(nFaces);
00069 face quadFace(4);
00070 label faceLabel = 0;
00071
00072 forAll(patchTopologyFaces, patchTopologyFaceLabel)
00073 {
00074 label blockLabel = blockLabels[patchTopologyFaceLabel];
00075
00076 faceList blockFaces
00077 (
00078 blocks[blockLabel].blockDef().blockShape().faces()
00079 );
00080
00081 forAll(blockFaces, blockFaceLabel)
00082 {
00083 if
00084 (
00085 blockFaces[blockFaceLabel]
00086 == patchTopologyFaces[patchTopologyFaceLabel]
00087 )
00088 {
00089 const labelListList& blockPatchFaces =
00090 blocks[blockLabel].boundaryPatches()[blockFaceLabel];
00091
00092 forAll(blockPatchFaces, blockFaceLabel)
00093 {
00094
00095
00096
00097 quadFace[0] =
00098 mergeList_
00099 [
00100 blockPatchFaces[blockFaceLabel][0]
00101 + blockOffsets_[blockLabel]
00102 ];
00103
00104 label nUnique = 1;
00105
00106 for
00107 (
00108 label facePointLabel = 1;
00109 facePointLabel < 4;
00110 facePointLabel++
00111 )
00112 {
00113 quadFace[nUnique] =
00114 mergeList_
00115 [
00116 blockPatchFaces[blockFaceLabel][facePointLabel]
00117 + blockOffsets_[blockLabel]
00118 ];
00119
00120 if (quadFace[nUnique] != quadFace[nUnique-1])
00121 {
00122 nUnique++;
00123 }
00124 }
00125
00126 if (quadFace[nUnique-1] == quadFace[0])
00127 {
00128 nUnique--;
00129 }
00130
00131 if (nUnique == 4)
00132 {
00133 patchFaces[faceLabel++] = quadFace;
00134 }
00135 else if (nUnique == 3)
00136 {
00137 patchFaces[faceLabel++] = face
00138 (
00139 labelList::subList(quadFace, 3)
00140 );
00141 }
00142
00143 }
00144 }
00145 }
00146 }
00147
00148 patchFaces.setSize(faceLabel);
00149
00150 return patchFaces;
00151 }
00152
00153
00154 Foam::faceListList Foam::blockMesh::createPatches()
00155 {
00156 Info<< "\nCreating patches\n";
00157
00158 const polyPatchList& patchTopologies = topology().boundaryMesh();
00159 faceListList patches(patchTopologies.size());
00160
00161 forAll(patchTopologies, patchLabel)
00162 {
00163 patches[patchLabel] =
00164 createPatchFaces(patchTopologies[patchLabel]);
00165 }
00166
00167 return patches;
00168 }
00169
00170