setEdge.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
00028
00029
00030
00031
00032 #include "error.H"
00033
00034 #include "blockDescriptor.H"
00035 #include "lineEdge.H"
00036 #include "lineDivide.H"
00037
00038
00039
00040 namespace Foam
00041 {
00042
00043
00044
00045 scalar calcGexp(const scalar expRatio, const label dim)
00046 {
00047 if (dim == 1)
00048 {
00049 return 0.0;
00050 }
00051 else
00052 {
00053 return pow(expRatio, 1.0/(dim - 1));
00054 }
00055 }
00056
00057
00058
00059
00060 void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
00061 {
00062
00063
00064
00065 bool found = false;
00066
00067
00068 const labelList& blockLabels = blockShape_;
00069
00070
00071 const pointField blockPoints = blockShape_.points(blockMeshPoints_);
00072
00073
00074 found = false;
00075
00076 forAll (curvedEdges_, nCEI)
00077 {
00078 if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end]))
00079 {
00080 found = true;
00081
00082
00083
00084
00085 if (blockLabels[start] == curvedEdges_[nCEI].start())
00086 {
00087
00088
00089 scalar gExp = calcGexp(expand_[edgeI], dim);
00090
00091
00092 lineDivide divEdge(curvedEdges_[nCEI], dim, gExp);
00093
00094 edgePoints_[edgeI] = divEdge.points();
00095 edgeWeights_[edgeI] = divEdge.lambdaDivisions();
00096 }
00097 else
00098 {
00099
00100 scalar gExp = calcGexp(expand_[edgeI], dim);
00101
00102
00103 lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL));
00104
00105 pointField p = divEdge.points();
00106 scalarList d = divEdge.lambdaDivisions();
00107
00108 edgePoints_[edgeI].setSize(p.size());
00109 edgeWeights_[edgeI].setSize(d.size());
00110
00111 label pMax = p.size() - 1;
00112 forAll (p, pI)
00113 {
00114 edgePoints_[edgeI][pI] = p[pMax - pI];
00115 edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI];
00116 }
00117 }
00118
00119 break;
00120 }
00121 }
00122
00123 if (!found)
00124 {
00125
00126 scalar gExp = calcGexp(expand_[edgeI], dim);
00127
00128
00129 lineDivide divEdge
00130 (
00131 lineEdge(blockPoints, start, end),
00132 dim,
00133 gExp
00134 );
00135
00136 edgePoints_[edgeI] = divEdge.points();
00137 edgeWeights_[edgeI] = divEdge.lambdaDivisions();
00138 }
00139 }
00140
00141
00142
00143
00144 }
00145
00146
Copyright © 2000-2009 OpenCFD Ltd