primitiveMeshEdgeCells.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 "primitiveMesh.H"
00028 #include "ListOps.H"
00029
00030
00031
00032
00033 const Foam::labelListList& Foam::primitiveMesh::edgeCells() const
00034 {
00035 if (!ecPtr_)
00036 {
00037 if (debug)
00038 {
00039 Pout<< "primitiveMesh::edgeCells() : calculating edgeCells" << endl;
00040
00041 if (debug == -1)
00042 {
00043
00044
00045 FatalErrorIn("primitiveMesh::edgeCells()")
00046 << abort(FatalError);
00047 }
00048 }
00049
00050 ecPtr_ = new labelListList(nEdges());
00051 invertManyToMany(nEdges(), cellEdges(), *ecPtr_);
00052 }
00053
00054 return *ecPtr_;
00055 }
00056
00057
00058 const Foam::labelList& Foam::primitiveMesh::edgeCells
00059 (
00060 const label edgeI,
00061 DynamicList<label>& storage
00062 ) const
00063 {
00064 if (hasEdgeCells())
00065 {
00066 return edgeCells()[edgeI];
00067 }
00068 else
00069 {
00070 const labelList& own = faceOwner();
00071 const labelList& nei = faceNeighbour();
00072
00073
00074 DynamicList<label> eFacesStorage;
00075 const labelList& eFaces = edgeFaces(edgeI, eFacesStorage);
00076
00077 storage.clear();
00078
00079
00080 forAll(eFaces, i)
00081 {
00082 label faceI = eFaces[i];
00083
00084 {
00085 label ownCellI = own[faceI];
00086
00087
00088 forAll(storage, j)
00089 {
00090 if (storage[j] == ownCellI)
00091 {
00092 ownCellI = -1;
00093 break;
00094 }
00095 }
00096
00097 if (ownCellI != -1)
00098 {
00099 storage.append(ownCellI);
00100 }
00101 }
00102
00103 if (isInternalFace(faceI))
00104 {
00105 label neiCellI = nei[faceI];
00106
00107 forAll(storage, j)
00108 {
00109 if (storage[j] == neiCellI)
00110 {
00111 neiCellI = -1;
00112 break;
00113 }
00114 }
00115
00116 if (neiCellI != -1)
00117 {
00118 storage.append(neiCellI);
00119 }
00120 }
00121 }
00122
00123 return storage;
00124 }
00125 }
00126
00127
00128 const Foam::labelList& Foam::primitiveMesh::edgeCells(const label edgeI) const
00129 {
00130 return edgeCells(edgeI, labels_);
00131 }
00132
00133
00134
Copyright © 2000-2009 OpenCFD Ltd