primitiveMeshCellEdges.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 "DynamicList.H"
00029 #include "ListOps.H"
00030
00031
00032
00033 void Foam::primitiveMesh::calcCellEdges() const
00034 {
00035
00036
00037
00038 if (debug)
00039 {
00040 Pout<< "primitiveMesh::calcCellEdges() : "
00041 << "calculating cellEdges"
00042 << endl;
00043
00044 if (debug == -1)
00045 {
00046
00047
00048 FatalErrorIn("primitiveMesh::calcCellEdges()")
00049 << abort(FatalError);
00050 }
00051 }
00052
00053
00054
00055 if (cePtr_)
00056 {
00057 FatalErrorIn("primitiveMesh::calcCellEdges() const")
00058 << "cellEdges already calculated"
00059 << abort(FatalError);
00060 }
00061 else
00062 {
00063
00064 List<DynamicList<label, edgesPerCell_> > ce(nCells());
00065
00066
00067
00068 const labelList& own = faceOwner();
00069 const labelList& nei = faceNeighbour();
00070 const labelListList& fe = faceEdges();
00071
00072
00073 forAll (own, faceI)
00074 {
00075 DynamicList<label, edgesPerCell_>& curCellEdges = ce[own[faceI]];
00076
00077 const labelList& curEdges = fe[faceI];
00078
00079 forAll (curEdges, edgeI)
00080 {
00081 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
00082 {
00083
00084 curCellEdges.append(curEdges[edgeI]);
00085 }
00086 }
00087 }
00088
00089 forAll (nei, faceI)
00090 {
00091 DynamicList<label, edgesPerCell_>& curCellEdges = ce[nei[faceI]];
00092
00093 const labelList& curEdges = fe[faceI];
00094
00095 forAll (curEdges, edgeI)
00096 {
00097 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
00098 {
00099
00100 curCellEdges.append(curEdges[edgeI]);
00101 }
00102 }
00103 }
00104
00105 cePtr_ = new labelListList(ce.size());
00106 labelListList& cellEdgeAddr = *cePtr_;
00107
00108
00109 forAll (ce, cellI)
00110 {
00111 cellEdgeAddr[cellI].transfer(ce[cellI]);
00112 }
00113 }
00114 }
00115
00116
00117
00118
00119 const Foam::labelListList& Foam::primitiveMesh::cellEdges() const
00120 {
00121 if (!cePtr_)
00122 {
00123 calcCellEdges();
00124 }
00125
00126 return *cePtr_;
00127 }
00128
00129
00130
Copyright © 2000-2009 OpenCFD Ltd