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