primitiveMeshEdgeFaces.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 const Foam::labelListList& Foam::primitiveMesh::edgeFaces() const
00033 {
00034 if (!efPtr_)
00035 {
00036 if (debug)
00037 {
00038 Pout<< "primitiveMesh::edgeFaces() : calculating edgeFaces" << endl;
00039
00040 if (debug == -1)
00041 {
00042
00043
00044 FatalErrorIn("primitiveMesh::edgeFaces()")
00045 << abort(FatalError);
00046 }
00047 }
00048
00049
00050 efPtr_ = new labelListList(nEdges());
00051 invertManyToMany(nEdges(), faceEdges(), *efPtr_);
00052 }
00053
00054 return *efPtr_;
00055 }
00056
00057
00058 const Foam::labelList& Foam::primitiveMesh::edgeFaces
00059 (
00060 const label edgeI,
00061 DynamicList<label>& storage
00062 ) const
00063 {
00064 if (hasEdgeFaces())
00065 {
00066 return edgeFaces()[edgeI];
00067 }
00068 else
00069 {
00070
00071 const edge& e = edges()[edgeI];
00072 const labelList& pFaces0 = pointFaces()[e[0]];
00073 const labelList& pFaces1 = pointFaces()[e[1]];
00074
00075 label i0 = 0;
00076 label i1 = 0;
00077
00078 storage.clear();
00079
00080 while (i0 < pFaces0.size() && i1 < pFaces1.size())
00081 {
00082 if (pFaces0[i0] < pFaces1[i1])
00083 {
00084 ++i0;
00085 }
00086 else if (pFaces0[i0] > pFaces1[i1])
00087 {
00088 ++i1;
00089 }
00090 else
00091 {
00092
00093 storage.append(pFaces0[i0]);
00094 ++i0;
00095 ++i1;
00096 }
00097 }
00098
00099 return storage;
00100 }
00101 }
00102
00103
00104 const Foam::labelList& Foam::primitiveMesh::edgeFaces(const label edgeI) const
00105 {
00106 return edgeFaces(edgeI, labels_);
00107 }
00108
00109
00110
Copyright © 2000-2009 OpenCFD Ltd