Merge branch 'master' into splitCyclic

Conflicts:
	applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
	applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C
	etc/bashrc
	etc/cshrc
	src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
	src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
	src/decompositionMethods/parMetisDecomp/parMetisDecomp.C
	src/dynamicMesh/Make/files
	src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
	src/dynamicMesh/perfectInterface/perfectInterface.C
	src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C
	src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C
	src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H
	src/finiteVolume/Make/files
	src/mesh/blockMesh/blockMesh/blockMesh.C
	src/mesh/blockMesh/blockMesh/blockMeshTopology.C
	src/meshTools/Make/files
	src/meshTools/sets/topoSets/faceSet.C
This commit is contained in:
mattijs
2009-11-30 15:20:52 +00:00
2132 changed files with 217596 additions and 24407 deletions

View File

@ -50,6 +50,7 @@ Description
#include "mathematicalConstants.H"
#include "PackedBoolList.H"
#include "SortableList.H"
#include "unitConversion.H"
using namespace Foam;
@ -467,7 +468,7 @@ int main(int argc, char *argv[])
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);
scalar maxCos = Foam::cos(degToRad(angle));
Info<< "Merging:" << nl
<< " edges with length less than " << minLen << " meters" << nl

View File

@ -53,7 +53,7 @@ Description
#include "removePoints.H"
#include "polyMesh.H"
#include "mapPolyMesh.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
using namespace Foam;
@ -451,12 +451,12 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
scalar concaveAngle = defaultConcaveAngle;
args.optionReadIfPresent("concaveAngle", concaveAngle);
scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.optionFound("overwrite");

View File

@ -7,4 +7,5 @@ EXE_INC = \
EXE_LIBS = \
-ldynamicMesh \
-lmeshTools \
-lfiniteVolume
-lfiniteVolume \
-lgenericPatchFields

View File

@ -6,4 +6,5 @@ EXE_INC = \
EXE_LIBS = \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume
-lfiniteVolume \
-lgenericPatchFields

View File

@ -49,7 +49,7 @@ Description
#include "cellSet.H"
#include "cellModeller.H"
#include "meshCutter.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "geomCellLooper.H"
#include "plane.H"
#include "edgeVertex.H"
@ -539,9 +539,8 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar radAngle = featureAngle * mathematicalConstant::pi/180.0;
scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle);
scalar minCos = Foam::cos(degToRad(featureAngle));
scalar minSin = Foam::sin(degToRad(featureAngle));
bool readSet = args.optionFound("set");
bool geometry = args.optionFound("geometry");

View File

@ -908,10 +908,10 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
foamPoints,
foamFaces,
foamOwner,
foamNeighbour
xferMove<pointField>(foamPoints),
xferMove<faceList>(foamFaces),
xferCopy<labelList>(foamOwner),
xferMove<labelList>(foamNeighbour)
);
// Create patches. Use patch types to determine what Foam types to generate.

View File

@ -39,6 +39,8 @@ Description
\* ------------------------------------------------------------------------- */
#include <sstream>
// For EOF only
#include <cstdio>
#include "scalar.H"
#include "IStringStream.H"

View File

@ -174,17 +174,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const
nWrittenFaces += patchFaces.size();
// Write patch type
if
(
typeid(boundary()[patchI]) == typeid(wallFvPatch)
)
if (isA<wallFvPatch>(boundary()[patchI]))
{
fluentMeshFile << 3;
}
else if
(
typeid(boundary()[patchI]) == typeid(symmetryFvPatch)
)
else if (isA<symmetryFvPatch>(boundary()[patchI]))
{
fluentMeshFile << 7;
}
@ -282,17 +276,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const
<< "(39 (" << patchI + 10 << " ";
// Write patch type
if
(
typeid(boundary()[patchI]) == typeid(wallFvPatch)
)
if (isA<wallFvPatch>(boundary()[patchI]))
{
fluentMeshFile << "wall ";
}
else if
(
typeid(boundary()[patchI]) == typeid(symmetryFvPatch)
)
else if (isA<symmetryFvPatch>(boundary()[patchI]))
{
fluentMeshFile << "symmetry ";
}

View File

@ -41,6 +41,9 @@ Description
#include "scalarList.H"
#include "IStringStream.H"
// For EOF only
#include <cstdio>
using namespace Foam;
#include "argList.H"

View File

@ -0,0 +1,79 @@
// Parametres geometriques
r1 = 200*Cos(Pi/4)/1000;
r2 = 200*Cos(Pi/4)/1000;
h1 = 250/1000;
h2 = 360/1000;
h3 = 900/1000;
h4 = 1900/1000;
// Parametres de maillage
// selon le rayon
rCells = 10/2; rRatio = 0.85;
// selon S1
S1Cells = 30/2; S1ratio = 1;
// selon S2
S2Cells = 35/2; S2ratio = 0.95;
// selon S3
S3Cells = 20/2; S3ratio = 1;
Point(1) = {r1, r1, h4};
Point(2) = {r1, r1, h3};
Point(3) = {r2, r2, h2};
Point(4) = {r2, r2, h1};
Point(5) = {0, 0, h1};
Point(6) = {0, 0, h2};
Point(7) = {0, 0, h3};
Point(8) = {0, 0, h4};
Line(1) = {8, 1};
Line(2) = {1, 2};
Line(3) = {7, 2};
Line(4) = {8, 7};
Line(5) = {2, 3};
Line(6) = {6, 3};
Line(7) = {7, 6};
Line(8) = {3, 4};
Line(9) = {5, 4};
Line(10) = {6, 5};
Line Loop(11) = {1, 2, -3, -4};
Ruled Surface(12) = {11};
Line Loop(13) = {5, -6, -7, 3};
Ruled Surface(14) = {13};
Line Loop(15) = {8, -9, -10, 6};
Ruled Surface(16) = {15};
Transfinite Line {1, 3, 6, 9} = rCells Using Progression rRatio;
Transfinite Line {4, 2} = S1Cells Using Progression S1ratio;
Transfinite Line {7, 5} = S2Cells Using Progression S2ratio;
Transfinite Line {10, 8} = S3Cells Using Progression S3ratio;
Transfinite Surface {12} = {8, 1, 2, 7};
Transfinite Surface {14} = {7, 2, 3, 6};
Transfinite Surface {16} = {6, 3, 4, 5};
Recombine Surface {12, 14, 16};
Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
Surface{12, 14, 16};
Layers{25};
Recombine;
}
Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
Surface{33, 50, 67};
Layers{25};
Recombine;
}
Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
Surface{84, 101, 118};
Layers{25};
Recombine;
}
Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
Surface{135, 152, 169};
Layers{25};
Recombine;
}
Physical Surface("entree") = {126, 75, 24, 177};
Physical Surface("S1") = {28, 181, 130, 79};
Physical Surface("S2") = {93, 42, 193, 144};
Physical Surface("S3") = {110, 59, 205, 161};
Physical Surface("fond") = {113, 62, 208, 164};
Physical Volume("fluide") = {4, 7, 10, 1, 5, 8, 11, 2, 9, 12, 3, 6};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -312,11 +312,36 @@ void readPhysNames(IFstream& inFile, Map<word>& physicalNames)
string line;
inFile.getLine(line);
IStringStream lineStr(line);
label nSpaces = lineStr.str().count(' ');
lineStr >> regionI >> regionName;
if(nSpaces == 1)
{
lineStr >> regionI >> regionName;
Info<< " " << regionI << '\t' << string::validate<word>(regionName)
<< endl;
Info<< " " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
}
else if(nSpaces == 2)
{
// >= Gmsh2.4 physical types has tag in front.
label physType;
lineStr >> physType >> regionI >> regionName;
if (physType == 1)
{
Info<< " " << "Line " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
}
else if (physType == 2)
{
Info<< " " << "Surface " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
}
else if (physType == 3)
{
Info<< " " << "Volume " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
}
}
physicalNames.insert(regionI, string::validate<word>(regionName));
}

View File

@ -208,12 +208,13 @@ void readPoints
{
hasWarned = true;
WarningIn
IOWarningIn
(
"readPoints(IFstream&, label&, DynamicList<point>"
", DynamicList<label>&)"
", DynamicList<label>&)",
is
) << "Points not in order starting at point " << pointI
<< " at line " << is.lineNumber()
//<< " at line " << is.lineNumber()
//<< abort(FatalError);
<< endl;
}
@ -429,47 +430,53 @@ void readPatches
>> dofSet >> tempSet >> contactSet >> nFaces;
is.getLine(line);
patchNames.append(string::validate<word>(line));
word groupName = string::validate<word>(line);
Info<< "For facegroup " << group
<< " named " << patchNames[patchNames.size()-1]
Info<< "For group " << group
<< " named " << groupName
<< " trying to read " << nFaces << " patch face indices."
<< endl;
patchFaceIndices.append(labelList(0));
labelList& faceIndices = patchFaceIndices[patchFaceIndices.size()-1];
faceIndices.setSize(nFaces);
label faceI = 0;
labelList groupIndices(nFaces);
label groupType = -1;
nFaces = 0;
while (faceI < faceIndices.size())
while (nFaces < groupIndices.size())
{
is.getLine(line);
IStringStream lineStr(line);
// Read one (for last face) or two entries from line.
label nRead = 2;
if (faceI == faceIndices.size()-1)
if (nFaces == groupIndices.size()-1)
{
nRead = 1;
}
for (label i = 0; i < nRead; i++)
{
label typeCode, tag, nodeLeaf, component;
label tag, nodeLeaf, component;
lineStr >> typeCode >> tag >> nodeLeaf >> component;
lineStr >> groupType >> tag >> nodeLeaf >> component;
if (typeCode != 8)
{
FatalErrorIn("readPatches")
<< "When reading patches expect Entity Type Code 8"
<< nl << "At line " << is.lineNumber()
<< exit(FatalError);
}
faceIndices[faceI++] = tag;
groupIndices[nFaces++] = tag;
}
}
// Store
if (groupType == 8)
{
patchNames.append(groupName);
patchFaceIndices.append(groupIndices);
}
else
{
IOWarningIn("readPatches(..)", is)
<< "When reading patches expect entity type code 8"
<< nl << " Skipping group code " << groupType
<< endl;
}
}
patchNames.shrink();

View File

@ -0,0 +1,394 @@
-1
2411
1 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 0.0000000000000000E+00
2 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 2.1000000000000000E+02
3 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 0.0000000000000000E+00
4 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 2.1000000000000000E+02
5 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 0.0000000000000000E+00
6 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 2.1000000000000000E+02
7 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00
8 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 2.1000000000000000E+02
9 0 0 0
0.0000000000000000E+00 1.0020000000000000E+02 2.1000000000000000E+02
10 0 0 0
0.0000000000000000E+00 2.0009999999999999E+02 2.1000000000000000E+02
11 0 0 0
1.0000000000000000E+02 3.0000000000000000E+02 2.1000000000000000E+02
12 0 0 0
2.0000000000000000E+02 1.0020000000000000E+02 2.1000000000000000E+02
13 0 0 0
2.0000000000000000E+02 2.0009999999999999E+02 2.1000000000000000E+02
14 0 0 0
1.0000000000000000E+02 0.0000000000000000E+00 2.1000000000000000E+02
15 0 0 0
0.0000000000000000E+00 1.0020000000000000E+02 0.0000000000000000E+00
16 0 0 0
0.0000000000000000E+00 2.0009999999999999E+02 0.0000000000000000E+00
17 0 0 0
1.0000000000000000E+02 3.0000000000000000E+02 0.0000000000000000E+00
18 0 0 0
2.0000000000000000E+02 1.0020000000000000E+02 0.0000000000000000E+00
19 0 0 0
2.0000000000000000E+02 2.0009999999999999E+02 0.0000000000000000E+00
20 0 0 0
1.0000000000000000E+02 0.0000000000000000E+00 0.0000000000000000E+00
21 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 1.0500000000000000E+02
22 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 1.0500000000000000E+02
23 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 1.0500000000000000E+02
24 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 1.0500000000000000E+02
25 0 0 0
9.6161727574445891E+01 1.3290789499900029E+02 2.1000000000000000E+02
26 0 0 0
8.0082880863556014E+01 2.2412763570985578E+02 2.1000000000000000E+02
27 0 0 0
9.6161727574240444E+01 1.3290789499883087E+02 0.0000000000000000E+00
28 0 0 0
8.0082880863392205E+01 2.2412763570989483E+02 0.0000000000000000E+00
29 0 0 0
2.0000000000000000E+02 1.5011560268321134E+02 1.0500000000592973E+02
30 0 0 0
0.0000000000000000E+00 1.5011560299451648E+02 1.0499999963389952E+02
31 0 0 0
9.9094099553883055E+01 7.2457929267250009E+01 1.0499999994714025E+02
-1
-1
2412
1 11 2 1 7 2
0 0 0
9 8
2 11 2 1 7 2
0 0 0
10 9
3 11 2 1 7 2
0 0 0
6 10
4 11 2 1 7 2
0 0 0
11 6
5 11 2 1 7 2
0 0 0
2 11
6 11 2 1 7 2
0 0 0
4 12
7 11 2 1 7 2
0 0 0
12 13
8 11 2 1 7 2
0 0 0
13 2
9 11 2 1 7 2
0 0 0
8 14
10 11 2 1 7 2
0 0 0
14 4
11 11 2 1 7 2
0 0 0
7 15
12 11 2 1 7 2
0 0 0
15 16
13 11 2 1 7 2
0 0 0
16 5
14 11 2 1 7 2
0 0 0
5 17
15 11 2 1 7 2
0 0 0
17 1
16 11 2 1 7 2
0 0 0
18 3
17 11 2 1 7 2
0 0 0
19 18
18 11 2 1 7 2
0 0 0
1 19
19 11 2 1 7 2
0 0 0
20 7
20 11 2 1 7 2
0 0 0
3 20
21 11 2 1 7 2
0 0 0
21 1
22 11 2 1 7 2
0 0 0
2 21
23 11 2 1 7 2
0 0 0
5 22
24 11 2 1 7 2
0 0 0
22 6
25 11 2 1 7 2
0 0 0
3 23
26 11 2 1 7 2
0 0 0
23 4
27 11 2 1 7 2
0 0 0
24 7
28 11 2 1 7 2
0 0 0
8 24
29 41 2 1 7 3
9 8 14
30 41 2 1 7 3
10 9 25
31 41 2 1 7 3
6 10 26
32 41 2 1 7 3
11 6 26
33 41 2 1 7 3
10 25 26
34 41 2 1 7 3
2 11 13
35 41 2 1 7 3
4 12 14
36 41 2 1 7 3
12 13 25
37 41 2 1 7 3
14 12 25
38 41 2 1 7 3
9 14 25
39 41 2 1 7 3
13 11 26
40 41 2 1 7 3
13 26 25
41 41 2 1 7 3
7 15 20
42 41 2 1 7 3
15 16 27
43 41 2 1 7 3
16 5 28
44 41 2 1 7 3
27 16 28
45 41 2 1 7 3
5 17 28
46 41 2 1 7 3
17 1 19
47 41 2 1 7 3
18 3 20
48 41 2 1 7 3
19 18 27
49 41 2 1 7 3
18 20 27
50 41 2 1 7 3
20 15 27
51 41 2 1 7 3
17 19 28
52 41 2 1 7 3
28 19 27
53 41 2 1 7 3
17 5 22
54 41 2 1 7 3
1 17 21
55 41 2 1 7 3
2 21 11
56 41 2 1 7 3
6 11 22
57 41 2 1 7 3
22 11 21
58 41 2 1 7 3
22 21 17
59 41 2 1 7 3
7 20 24
60 41 2 1 7 3
20 3 23
61 41 2 1 7 3
23 4 14
62 41 2 1 7 3
14 8 24
63 41 2 1 7 3
14 24 23
64 41 2 1 7 3
20 23 24
65 41 2 1 7 3
23 3 18
66 41 2 1 7 3
4 23 12
67 41 2 1 7 3
13 12 29
68 41 2 1 7 3
2 13 21
69 41 2 1 7 3
22 16 30
70 41 2 1 7 3
13 29 21
71 41 2 1 7 3
1 21 19
72 41 2 1 7 3
12 23 29
73 41 2 1 7 3
18 19 29
74 41 2 1 7 3
23 18 29
75 41 2 1 7 3
15 24 30
76 41 2 1 7 3
29 19 21
77 41 2 1 7 3
7 24 15
78 41 2 1 7 3
24 8 9
79 41 2 1 7 3
9 10 30
80 41 2 1 7 3
10 6 22
81 41 2 1 7 3
30 10 22
82 41 2 1 7 3
16 15 30
83 41 2 1 7 3
22 5 16
84 41 2 1 7 3
24 9 30
85 111 2 1 7 4
21 28 22 17
86 111 2 1 7 4
31 18 29 23
87 111 2 1 7 4
31 29 18 27
88 111 2 1 7 4
29 21 26 13
89 111 2 1 7 4
29 25 26 30
90 111 2 1 7 4
26 28 29 30
91 111 2 1 7 4
16 28 5 22
92 111 2 1 7 4
30 25 10 9
93 111 2 1 7 4
16 30 15 27
94 111 2 1 7 4
26 25 10 30
95 111 2 1 7 4
21 28 26 22
96 111 2 1 7 4
31 20 18 23
97 111 2 1 7 4
27 28 16 30
98 111 2 1 7 4
18 27 29 19
99 111 2 1 7 4
21 22 26 11
100 111 2 1 7 4
23 4 12 14
101 111 2 1 7 4
31 25 29 30
102 111 2 1 7 4
31 18 20 27
103 111 2 1 7 4
21 11 26 13
104 111 2 1 7 4
22 28 5 17
105 111 2 1 7 4
2 11 21 13
106 111 2 1 7 4
29 25 12 13
107 111 2 1 7 4
30 28 16 22
108 111 2 1 7 4
31 24 20 23
109 111 2 1 7 4
26 28 30 22
110 111 2 1 7 4
21 17 19 28
111 111 2 1 7 4
15 24 31 30
112 111 2 1 7 4
31 9 30 24
113 111 2 1 7 4
15 30 31 27
114 111 2 1 7 4
8 14 24 9
115 111 2 1 7 4
26 22 10 6
116 111 2 1 7 4
31 25 12 29
117 111 2 1 7 4
31 29 12 23
118 111 2 1 7 4
31 30 9 25
119 111 2 1 7 4
21 1 19 17
120 111 2 1 7 4
29 19 27 28
121 111 2 1 7 4
10 22 26 30
122 111 2 1 7 4
29 28 26 21
123 111 2 1 7 4
7 20 15 24
124 111 2 1 7 4
11 22 26 6
125 111 2 1 7 4
29 28 27 30
126 111 2 1 7 4
31 23 12 14
127 111 2 1 7 4
26 25 29 13
128 111 2 1 7 4
15 27 31 20
129 111 2 1 7 4
21 19 29 28
130 111 2 1 7 4
18 3 23 20
131 111 2 1 7 4
15 20 31 24
132 111 2 1 7 4
27 31 29 30
133 111 2 1 7 4
31 14 9 24
134 111 2 1 7 4
31 9 14 25
135 111 2 1 7 4
31 14 12 25
136 111 2 1 7 4
31 23 14 24
-1
-1
2467
0 0 0 0 0 0 0 10
outlet
8 70 0 0 8 67 0 0
8 68 0 0 8 71 0 0
8 76 0 0 8 66 0 0
8 72 0 0 8 73 0 0
8 74 0 0 8 65 0 0
1 0 0 0 0 0 0 12
inlet
8 36 0 0 8 30 0 0
8 31 0 0 8 37 0 0
8 34 0 0 8 38 0 0
8 33 0 0 8 35 0 0
8 32 0 0 8 29 0 0
8 39 0 0 8 40 0 0
2 0 0 0 0 0 0 12
nodes
7 2 0 0 7 4 0 0
7 6 0 0 7 8 0 0
7 9 0 0 7 10 0 0
7 11 0 0 7 12 0 0
7 13 0 0 7 14 0 0
7 25 0 0 7 26 0 0
-1

View File

@ -43,7 +43,7 @@ Description
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
using namespace Foam;

View File

@ -223,7 +223,7 @@ const char* kivaPatchNames[nBCs] =
"cylinderHead",
"axis",
"wedge",
"inflow",
"inflow",
"outflow",
"presin",
"presout",
@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
{
// Distribute the points to be +/- 2.5deg from the x-z plane
scalar tanTheta = Foam::tan(2.5*mathematicalConstant::pi/180.0);
scalar tanTheta = Foam::tan(degToRad(2.5));
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();

View File

@ -5,5 +5,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-ldynamicMesh \
-lmeshTools

View File

@ -59,7 +59,7 @@ Usage
#include "Time.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "polyTopoChange.H"
#include "mapPolyMesh.H"
#include "PackedBoolList.H"
@ -91,7 +91,7 @@ void simpleMarkFeatures
labelList& multiCellFeaturePoints
)
{
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -33,7 +33,7 @@ Description
#include "IOmanip.H"
#include "boundBox.H"
#include "Map.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
<< coupleI << ". STAR couple ID: "
<< couples_[coupleI].coupleID() << endl
<< "The angle between face normals is "
<< Foam::acos(faceAreaAngle)/mathematicalConstant::pi*180
<< radToDeg(Foam::acos(faceAreaAngle))
<< " deg." << endl
<< "master cell: " << fp.masterCell()
<< " STAR number: " << starCellID_[fp.masterCell()]

View File

@ -32,7 +32,8 @@ Description
patch_YYY_XXX.obj : all face centres of patch YYY
Optional: patch faces (as polygons) : patchFaces_YYY_XXX.obj
Optional: - patch faces (as polygons) : patchFaces_YYY_XXX.obj
- non-manifold edges : patchEdges_YYY_XXX.obj
\*---------------------------------------------------------------------------*/
@ -51,7 +52,7 @@ using namespace Foam;
void writeOBJ(const point& pt, Ostream& os)
{
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
}
// All edges of mesh
@ -75,8 +76,7 @@ void writePoints(const polyMesh& mesh, const fileName& timeName)
{
const edge& e = mesh.edges()[edgeI];
pointStream << "l " << e.start() + 1 << ' ' << e.end() + 1
<< endl;
pointStream << "l " << e.start() + 1 << ' ' << e.end() + 1 << nl;
}
}
@ -277,7 +277,47 @@ void writePatchFaces
{
patchFaceStream << ' ' << f[fp]+1;
}
patchFaceStream << endl;
patchFaceStream << nl;
}
}
}
void writePatchBoundaryEdges
(
const polyMesh& mesh,
const fileName& timeName
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
fileName edgeFile
(
mesh.time().path()
/ "patchEdges_" + pp.name() + '_' + timeName + ".obj"
);
Info << "Writing patch edges to " << edgeFile << endl;
OFstream patchEdgeStream(edgeFile);
forAll(pp.localPoints(), pointI)
{
writeOBJ(pp.localPoints()[pointI], patchEdgeStream);
}
for (label edgeI = pp.nInternalEdges(); edgeI < pp.nEdges(); edgeI++)
{
if (pp.edgeFaces()[edgeI].size() == 1)
{
const edge& e = pp.edges()[edgeI];
patchEdgeStream<< "l " << e[0]+1 << ' ' << e[1]+1 << nl;
}
}
}
}
@ -339,6 +379,7 @@ int main(int argc, char *argv[])
{
timeSelector::addOptions();
argList::validOptions.insert("patchFaces", "");
argList::validOptions.insert("patchEdges", "");
argList::validOptions.insert("cell", "cellI");
argList::validOptions.insert("face", "faceI");
argList::validOptions.insert("point", "pointI");
@ -351,6 +392,7 @@ int main(int argc, char *argv[])
runTime.functionObjects().off();
bool patchFaces = args.optionFound("patchFaces");
bool patchEdges = args.optionFound("patchEdges");
bool doCell = args.optionFound("cell");
bool doPoint = args.optionFound("point");
bool doFace = args.optionFound("face");
@ -381,19 +423,23 @@ int main(int argc, char *argv[])
{
writePatchFaces(mesh, runTime.timeName());
}
else if (doCell)
if (patchEdges)
{
writePatchBoundaryEdges(mesh, runTime.timeName());
}
if (doCell)
{
label cellI = args.optionRead<label>("cell");
writePoints(mesh, cellI, runTime.timeName());
}
else if (doPoint)
if (doPoint)
{
label pointI = args.optionRead<label>("point");
writePointCells(mesh, pointI, runTime.timeName());
}
else if (doFace)
if (doFace)
{
label faceI = args.optionRead<label>("face");
@ -415,7 +461,7 @@ int main(int argc, char *argv[])
meshTools::writeOBJ(str, faceList(1, f), mesh.points());
}
else if (doCellSet)
if (doCellSet)
{
word setName(args.option("cellSet"));
@ -427,7 +473,7 @@ int main(int argc, char *argv[])
writePoints(mesh, cells.toc(), runTime.timeName());
}
else if (doFaceSet)
if (doFaceSet)
{
word setName(args.option("faceSet"));
@ -458,7 +504,16 @@ int main(int argc, char *argv[])
faces.toc()
);
}
else
else if
(
!patchFaces
&& !patchEdges
&& !doCell
&& !doPoint
&& !doFace
&& !doCellSet
&& !doFaceSet
)
{
// points & edges
writePoints(mesh, runTime.timeName());

View File

@ -1,31 +1,3 @@
curvedEdges = curvedEdges
$(curvedEdges)/curvedEdge.C
$(curvedEdges)/lineEdge.C
$(curvedEdges)/polyLine.C
$(curvedEdges)/polyLineEdge.C
$(curvedEdges)/arcEdge.C
$(curvedEdges)/spline.C
$(curvedEdges)/BSpline.C
$(curvedEdges)/simpleSplineEdge.C
$(curvedEdges)/polySplineEdge.C
$(curvedEdges)/lineDivide.C
blockMesh.C
blockDescriptor.C
setEdge.C
block.C
createTopology.C
checkBlockMesh.C
createBlockOffsets.C
createMergeList.C
createPoints.C
createCells.C
createPatches.C
blockPoints.C
blockCells.C
blockBoundary.C
blockMeshApp.C
EXE = $(FOAM_APPBIN)/blockMesh

View File

@ -1,8 +1,9 @@
EXE_INC = \
-I$(curvedEdges) \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lblockMesh \
-lmeshTools \
-ldynamicMesh

View File

@ -1,114 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
label block::vtxLabel(label a, label b, label c)
{
return (a + b*(blockDef_.n().x() + 1)
+ c*(blockDef_.n().x() + 1)*(blockDef_.n().y() + 1));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from description
block::block(const blockDescriptor& definition)
:
blockDef_(definition),
vertices_
(
((blockDef_.n().x() + 1)*(blockDef_.n().y() + 1)*(blockDef_.n().z() + 1))
),
cells_
(
(blockDef_.n().x()*blockDef_.n().y()*blockDef_.n().z())
),
boundaryPatches_(6)
{
// create points
blockPoints();
// generate internal cells
blockCells();
// generate boundary patches
blockBoundary();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const blockDescriptor& block::blockDef() const
{
return blockDef_;
}
const pointField& block::points() const
{
return vertices_;
}
const labelListList& block::cells() const
{
return cells_;
}
const labelListListList& block::boundaryPatches() const
{
return boundaryPatches_;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const block& b)
{
os << b.vertices_ << nl
<< b.cells_ << nl
<< b.boundaryPatches_ << endl;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::block
Description
creates a single block of cells from point coordinates,
numbers of cells in each direction and expansion ratio
SourceFiles
block.C
\*---------------------------------------------------------------------------*/
#ifndef block_H
#define block_H
#include "pointField.H"
#include "labelList.H"
#include "blockDescriptor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
/*---------------------------------------------------------------------------*\
Class block Declaration
\*---------------------------------------------------------------------------*/
class block
{
// Private data
//- block definition
blockDescriptor blockDef_;
//- list of vertices
pointField vertices_;
//- list of cells
labelListList cells_;
//- boundary patches
labelListListList boundaryPatches_;
// private member functions
label vtxLabel(label i, label j, label k);
void blockPoints();
void blockCells();
void blockBoundary();
public:
// Constructors
//- Construct from the block definition
block(const blockDescriptor&);
//- Clone
autoPtr<block> clone() const
{
notImplemented("block::clone()");
return autoPtr<block>(NULL);
}
// Member Functions
// Access
const blockDescriptor& blockDef() const;
const pointField& points() const;
const labelListList& cells() const;
const labelListListList& boundaryPatches() const;
// Ostream Operator
friend Ostream& operator<<(Ostream&, const block&);
};
inline Istream& operator>>(Istream& is, block*)
{
notImplemented("Istream& operator>>(Istream& is, block*)");
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,209 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates boundary patches for the block
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockBoundary()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
// x-direction
label wallLabel = 0;
label wallCellLabel = 0;
// x-min
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(0, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(0, j, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(0, j + 1, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(0, j + 1, k);
// update the counter
wallCellLabel++;
}
}
// x-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(ni, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(ni, j+1, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(ni, j+1, k+1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(ni, j, k+1);
// update the counter
wallCellLabel++;
}
}
// y-direction
// y-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, 0, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, 0, k + 1);
// update the counter
wallCellLabel++;
}
}
// y-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, nj, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, nj, k);
// update the counter
wallCellLabel++;
}
}
// z-direction
// z-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, 0);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, j, 0);
// update the counter
wallCellLabel++;
}
}
// z-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, nk);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, j + 1, nk);
// update the counter
wallCellLabel++;
}
}
}
// ************************************************************************* //

View File

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates cells for the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockCells()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
label cellNo = 0;
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
for (label i = 0; i <= ni - 1; i++)
{
cells_[cellNo].setSize(8);
cells_[cellNo][0] = vtxLabel(i, j, k);
cells_[cellNo][1] = vtxLabel(i+1, j, k);
cells_[cellNo][2] = vtxLabel(i+1, j+1, k);
cells_[cellNo][3] = vtxLabel(i, j+1, k);
cells_[cellNo][4] = vtxLabel(i, j, k+1);
cells_[cellNo][5] = vtxLabel(i+1, j, k+1);
cells_[cellNo][6] = vtxLabel(i+1, j+1, k+1);
cells_[cellNo][7] = vtxLabel(i, j+1, k+1);
cellNo++;
}
}
}
}
// ************************************************************************* //

View File

@ -1,248 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockDescriptor.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void blockDescriptor::makeBlockEdges()
{
// for all edges check the list of curved edges. If the edge is curved,
// add it to the list. If the edge is not found, create is as a line
setEdge(0, 0, 1, n_.x());
setEdge(1, 3, 2, n_.x());
setEdge(2, 7, 6, n_.x());
setEdge(3, 4, 5, n_.x());
setEdge(4, 0, 3, n_.y());
setEdge(5, 1, 2, n_.y());
setEdge(6, 5, 6, n_.y());
setEdge(7, 4, 7, n_.y());
setEdge(8, 0, 4, n_.z());
setEdge(9, 1, 5, n_.z());
setEdge(10, 2, 6, n_.z());
setEdge(11, 3, 7, n_.z());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
blockDescriptor::blockDescriptor
(
const cellShape& bshape,
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
const Vector<label>& n,
const scalarList& expand,
const word& zoneName
)
:
blockMeshPoints_(blockMeshPoints),
blockShape_(bshape),
curvedEdges_(edges),
edgePoints_(12),
edgeWeights_(12),
n_(n),
expand_(expand),
zoneName_(zoneName)
{
if (expand_.size() != 12)
{
FatalErrorIn
(
"blockDescriptor::blockDescriptor"
"(const cellShape& bshape, const pointField& blockMeshPoints, "
"const curvedEdgeList& edges, label xnum, label ynum, label znum, "
"const scalarList& expand, const word& zoneName)"
) << "Unknown definition of expansion ratios"
<< exit(FatalError);
}
makeBlockEdges();
}
// from Istream
blockDescriptor::blockDescriptor
(
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
Istream& is
)
:
blockMeshPoints_(blockMeshPoints),
blockShape_(is),
curvedEdges_(edges),
edgePoints_(12),
edgeWeights_(12),
n_(),
expand_(12),
zoneName_()
{
// Look at first token
token t(is);
is.putBack(t);
// Optional zone name
if (t.isWord())
{
zoneName_ = t.wordToken();
// Consume zoneName token
is >> t;
// New look-ahead
is >> t;
is.putBack(t);
}
if (t.isPunctuation())
{
if (t.pToken() == token::BEGIN_LIST)
{
is >> n_;
}
else
{
FatalIOErrorIn
(
"blockDescriptor::blockDescriptor"
"(const pointField&, const curvedEdgeList&, Istream& is)",
is
) << "incorrect token while reading n, expected '(', found "
<< t.info()
<< exit(FatalIOError);
}
}
else
{
is >> n_.x() >> n_.y() >> n_.z();
}
is >> t;
if (!t.isWord())
{
is.putBack(t);
}
scalarList expRatios(is);
if (expRatios.size() == 3)
{
expand_[0] = expRatios[0];
expand_[1] = expRatios[0];
expand_[2] = expRatios[0];
expand_[3] = expRatios[0];
expand_[4] = expRatios[1];
expand_[5] = expRatios[1];
expand_[6] = expRatios[1];
expand_[7] = expRatios[1];
expand_[8] = expRatios[2];
expand_[9] = expRatios[2];
expand_[10] = expRatios[2];
expand_[11] = expRatios[2];
}
else if (expRatios.size() == 12)
{
expand_ = expRatios;
}
else
{
FatalErrorIn
(
"blockDescriptor::blockDescriptor"
"(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
"Istream& is)"
) << "Unknown definition of expansion ratios"
<< exit(FatalError);
}
// create a list of edges
makeBlockEdges();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const pointField& blockDescriptor::points() const
{
return blockMeshPoints_;
}
const cellShape& blockDescriptor::blockShape() const
{
return blockShape_;
}
const List<List<point> >& blockDescriptor::blockEdgePoints() const
{
return edgePoints_;
}
const scalarListList& blockDescriptor::blockEdgeWeights() const
{
return edgeWeights_;
}
const Vector<label>& blockDescriptor::n() const
{
return n_;
}
const word& blockDescriptor::zoneName() const
{
return zoneName_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void blockDescriptor::operator=(const blockDescriptor&)
{
notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::blockDescriptor
Description
block descriptor. Takes the description of the block and the list
of curved edges and creates a list of points on edges together
with the weighting factors
SourceFiles
blockDescriptor.C
\*---------------------------------------------------------------------------*/
#ifndef blockDescriptor_H
#define blockDescriptor_H
#include "scalar.H"
#include "label.H"
#include "point.H"
#include "cellShape.H"
#include "scalarList.H"
#include "curvedEdgeList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
/*---------------------------------------------------------------------------*\
Class blockDescriptor Declaration
\*---------------------------------------------------------------------------*/
class blockDescriptor
{
// Private data
//- Block mesh points
const pointField& blockMeshPoints_;
//- block shape
cellShape blockShape_;
// reference to a list of curved edges
const curvedEdgeList& curvedEdges_;
// block edge points
List<List<point> > edgePoints_;
//- block edge weighting factors
scalarListList edgeWeights_;
//- number of point in each direction
Vector<label> n_;
//- expansion ratios in all directions
scalarList expand_;
//- name of the zone (empty string if none)
word zoneName_;
// Private member functions
void makeBlockEdges();
void setEdge(label edge, label start, label end, label dim);
public:
// Constructors
//- Construct from components. Optional cellSet/zone name.
blockDescriptor
(
const cellShape&,
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
const Vector<label>& n,
const scalarList& expand,
const word& zoneName = ""
);
//- Construct from Istream
blockDescriptor
(
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
Istream& is
);
//- Clone
autoPtr<blockDescriptor> clone() const
{
notImplemented("blockDescriptor::clone()");
return autoPtr<blockDescriptor>(NULL);
}
// Member Functions
// Access
const pointField& points() const;
const cellShape& blockShape() const;
const List<List<point> >& blockEdgePoints() const;
const scalarListList& blockEdgeWeights() const;
const Vector<label>& n() const;
const word& zoneName() const;
// Member Operators
void operator=(const blockDescriptor&);
// IOstream Operators
friend Ostream& operator<<(Ostream&, const blockDescriptor&);
};
inline Istream& operator>>(Istream& is, blockDescriptor*)
{
notImplemented("Istream& operator>>(Istream& is, blockDescriptor*)");
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::blockList
Description
SourceFiles
blockList.C
\*---------------------------------------------------------------------------*/
#ifndef blockList_H
#define blockList_H
#include "block.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef PtrList<block> blockList;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
blockMesh
Description
Mesh generator
\*---------------------------------------------------------------------------*/
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from IOdictionary
Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
:
topologyPtr_(createTopology(meshDescription)),
blockOffsets_(createBlockOffsets()),
mergeList_(createMergeList()),
points_(createPoints(meshDescription)),
cells_(createCells()),
patches_(createPatches())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::blockMesh::~blockMesh()
{
delete topologyPtr_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::polyMesh& Foam::blockMesh::topology() const
{
if (!topologyPtr_)
{
FatalErrorIn("blockMesh::topology() const")
<< "topologyPtr_ not allocated"
<< exit(FatalError);
}
return *topologyPtr_;
}
Foam::PtrList<Foam::dictionary> Foam::blockMesh::patchDicts() const
{
const polyPatchList& patchTopologies = topology().boundaryMesh();
PtrList<dictionary> patchDicts(patchTopologies.size());
forAll(patchTopologies, patchI)
{
OStringStream os;
patchTopologies[patchI].write(os);
IStringStream is(os.str());
patchDicts.set(patchI, new dictionary(is));
patchDicts[patchI].set("name", patchTopologies[patchI].name());
}
return patchDicts;
}
//Foam::wordList Foam::blockMesh::patchNames() const
//{
// const polyPatchList& patchTopologies = topology().boundaryMesh();
// wordList names(patchTopologies.size());
//
// forAll (names, patchI)
// {
// names[patchI] = patchTopologies[patchI].name();
// }
//
// return names;
//}
//
//
//Foam::wordList Foam::blockMesh::patchTypes() const
//{
// const polyPatchList& patchTopologies = topology().boundaryMesh();
// wordList types(patchTopologies.size());
//
// forAll (types, patchI)
// {
// types[patchI] = patchTopologies[patchI].type();
// }
//
// return types;
//}
//
//
//Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
//{
// const polyPatchList& patchTopologies = topology().boundaryMesh();
// wordList physicalTypes(patchTopologies.size());
//
// forAll (physicalTypes, patchI)
// {
// OStringStream os;
// patchTopologies[patchI].write(os);
// IStringStream is(os.str());
// patchDicts.set(patchI, new dictionary(is));
// patchDicts[patchI].set("name", patchTopologies[patchI].name());
// }
// return patchDicts;
//}
Foam::label Foam::blockMesh::numZonedBlocks() const
{
label num = 0;
forAll(*this, blockI)
{
if (operator[](blockI).blockDef().zoneName().size())
{
num++;
}
}
return num;
}
void Foam::blockMesh::writeTopology(Ostream& os) const
{
const pointField& pts = topology().points();
forAll(pts, pI)
{
const point& pt = pts[pI];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
const edgeList& edges = topology().edges();
forAll(edges, eI)
{
const edge& e = edges[eI];
os << "l " << e.start() + 1 << ' ' << e.end() + 1 << endl;
}
}
// ************************************************************************* //

View File

@ -1,198 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::blockMesh
Description
SourceFiles
blockMesh.C
\*---------------------------------------------------------------------------*/
#ifndef blockMesh_H
#define blockMesh_H
#include "blockList.H"
#include "polyMesh.H"
#include "IOdictionary.H"
#include "curvedEdgeList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class blockMesh Declaration
\*---------------------------------------------------------------------------*/
class blockMesh
:
public blockList
{
// Private data
label nPoints_;
label nCells_;
curvedEdgeList edges_;
polyMesh* topologyPtr_;
labelList blockOffsets_;
labelList mergeList_;
pointField points_;
cellShapeList cells_;
faceListList patches_;
// Private Member Functions
bool blockLabelsOK
(
const label blockLabel,
const pointField& points,
const cellShape& blockShape
);
bool patchLabelsOK
(
const label patchLabel,
const pointField& points,
const faceList& patchShapes
);
bool readPatches
(
const dictionary& meshDescription,
const pointField& tmpBlockPoints,
faceListList& tmpBlocksPatches,
wordList& patchNames,
wordList& patchTypes,
wordList& nbrPatchNames
);
bool readBoundary
(
const dictionary& meshDescription,
const pointField& tmpBlockPoints,
faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts
);
void createCellShapes
(
const pointField& tmpBlockPoints,
PtrList<cellShape>& tmpBlockCells
);
polyMesh* createTopology(IOdictionary&);
void checkBlockMesh(const polyMesh&);
labelList createBlockOffsets();
labelList createMergeList();
pointField createPoints(const dictionary&);
cellShapeList createCells();
faceList createPatchFaces(const polyPatch& patchTopologyFaces);
faceListList createPatches();
//- as copy (not implemented)
blockMesh(const blockMesh&);
public:
// Constructors
//- Construct from IOdictionary
blockMesh(IOdictionary&);
// Destructor
~blockMesh();
// Member Functions
// Access
const polyMesh& topology() const;
const curvedEdgeList& edges() const
{
return edges_;
}
const pointField& points() const
{
return points_;
}
const cellShapeList& cells() const
{
return cells_;
}
const faceListList& patches() const
{
return patches_;
}
//- Get patch information from the topology mesh
PtrList<dictionary> patchDicts() const;
// wordList patchNames() const;
//
// wordList patchTypes() const;
//
// wordList patchPhysicalTypes() const;
//- Number of blocks with specified zones
label numZonedBlocks() const;
// Write
//- Writes edges of blockMesh in OBJ format.
void writeTopology(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -146,8 +146,10 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< nl << "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << nl << endl;
Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict);
@ -195,12 +197,10 @@ int main(int argc, char *argv[])
}
Info<< nl << "Creating mesh from block mesh" << endl;
Info<< nl << "Creating polyMesh from blockMesh" << endl;
word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName;
polyMesh mesh
(
IOobject
@ -322,7 +322,7 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10
IOstream::defaultPrecision(10);
Info << nl << "Writing polyMesh" << endl;
Info<< nl << "Writing polyMesh" << endl;
mesh.removeFiles();
if (!mesh.write())
{
@ -331,6 +331,38 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
//
// write some information
//
{
const polyPatchList& patches = mesh.boundaryMesh();
Info<< "----------------" << nl
<< "Mesh Information" << nl
<< "----------------" << nl
<< " " << "boundingBox: " << boundBox(mesh.points()) << nl
<< " " << "nPoints: " << mesh.nPoints() << nl
<< " " << "nCells: " << mesh.nCells() << nl
<< " " << "nFaces: " << mesh.nFaces() << nl
<< " " << "nInternalFaces: " << mesh.nInternalFaces() << nl;
Info<< "----------------" << nl
<< "Patches" << nl
<< "----------------" << nl;
forAll(patches, patchI)
{
const polyPatch& p = patches[patchI];
Info<< " " << "patch " << patchI
<< " (start: " << p.start()
<< " size: " << p.size()
<< ") name: " << p.name()
<< nl;
}
}
Info<< nl << "End" << endl;
return 0;

View File

@ -1,232 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
private member of block. Creates vertices for cells filling the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockPoints()
{
// set local variables for mesh specification
const label ni = blockDef_.n().x();
const label nj = blockDef_.n().y();
const label nk = blockDef_.n().z();
const point p000 = blockDef_.points()[blockDef_.blockShape()[0]];
const point p100 = blockDef_.points()[blockDef_.blockShape()[1]];
const point p110 = blockDef_.points()[blockDef_.blockShape()[2]];
const point p010 = blockDef_.points()[blockDef_.blockShape()[3]];
const point p001 = blockDef_.points()[blockDef_.blockShape()[4]];
const point p101 = blockDef_.points()[blockDef_.blockShape()[5]];
const point p111 = blockDef_.points()[blockDef_.blockShape()[6]];
const point p011 = blockDef_.points()[blockDef_.blockShape()[7]];
// list of edge point and weighting factors
const List<List<point> >& p = blockDef_.blockEdgePoints();
const scalarListList& w = blockDef_.blockEdgeWeights();
// generate vertices
for (label k = 0; k <= nk; k++)
{
for (label j = 0; j <= nj; j++)
{
for (label i = 0; i <= ni; i++)
{
label vertexNo = vtxLabel(i, j, k);
// points on edges
vector edgex1 = p000 + (p100 - p000)*w[0][i];
vector edgex2 = p010 + (p110 - p010)*w[1][i];
vector edgex3 = p011 + (p111 - p011)*w[2][i];
vector edgex4 = p001 + (p101 - p001)*w[3][i];
vector edgey1 = p000 + (p010 - p000)*w[4][j];
vector edgey2 = p100 + (p110 - p100)*w[5][j];
vector edgey3 = p101 + (p111 - p101)*w[6][j];
vector edgey4 = p001 + (p011 - p001)*w[7][j];
vector edgez1 = p000 + (p001 - p000)*w[8][k];
vector edgez2 = p100 + (p101 - p100)*w[9][k];
vector edgez3 = p110 + (p111 - p110)*w[10][k];
vector edgez4 = p010 + (p011 - p010)*w[11][k];
// calculate the importance factors for all edges
// x - direction
scalar impx1 =
(
(1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k])
+ w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k])
);
scalar impx2 =
(
(1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k])
+ w[1][i]*w[5][j]*(1.0 - w[10][k])
);
scalar impx3 =
(
(1.0 - w[2][i])*w[7][j]*w[11][k]
+ w[2][i]*w[6][j]*w[10][k]
);
scalar impx4 =
(
(1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k]
+ w[3][i]*(1.0 - w[6][j])*w[9][k]
);
scalar magImpx = impx1 + impx2 + impx3 + impx4;
impx1 /= magImpx;
impx2 /= magImpx;
impx3 /= magImpx;
impx4 /= magImpx;
// y - direction
scalar impy1 =
(
(1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k])
+ w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k])
);
scalar impy2 =
(
(1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k])
+ w[5][j]*w[1][i]*(1.0 - w[10][k])
);
scalar impy3 =
(
(1.0 - w[6][j])*w[3][i]*w[9][k]
+ w[6][j]*w[2][i]*w[10][k]
);
scalar impy4 =
(
(1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k]
+ w[7][j]*(1.0 - w[2][i])*w[11][k]
);
scalar magImpy = impy1 + impy2 + impy3 + impy4;
impy1 /= magImpy;
impy2 /= magImpy;
impy3 /= magImpy;
impy4 /= magImpy;
// z - direction
scalar impz1 =
(
(1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j])
+ w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j])
);
scalar impz2 =
(
(1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j])
+ w[9][k]*w[3][i]*(1.0 - w[6][j])
);
scalar impz3 =
(
(1.0 - w[10][k])*w[1][i]*w[5][j]
+ w[10][k]*w[2][i]*w[6][j]
);
scalar impz4 =
(
(1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j]
+ w[11][k]*(1.0 - w[2][i])*w[7][j]
);
scalar magImpz = impz1 + impz2 + impz3 + impz4;
impz1 /= magImpz;
impz2 /= magImpz;
impz3 /= magImpz;
impz4 /= magImpz;
// calculate the correction vectors
vector corx1 = impx1*(p[0][i] - edgex1);
vector corx2 = impx2*(p[1][i] - edgex2);
vector corx3 = impx3*(p[2][i] - edgex3);
vector corx4 = impx4*(p[3][i] - edgex4);
vector cory1 = impy1*(p[4][j] - edgey1);
vector cory2 = impy2*(p[5][j] - edgey2);
vector cory3 = impy3*(p[6][j] - edgey3);
vector cory4 = impy4*(p[7][j] - edgey4);
vector corz1 = impz1*(p[8][k] - edgez1);
vector corz2 = impz2*(p[9][k] - edgez2);
vector corz3 = impz3*(p[10][k] - edgez3);
vector corz4 = impz4*(p[11][k] - edgez4);
// multiply by the importance factor
// x - direction
edgex1 *= impx1;
edgex2 *= impx2;
edgex3 *= impx3;
edgex4 *= impx4;
// y - direction
edgey1 *= impy1;
edgey2 *= impy2;
edgey3 *= impy3;
edgey4 *= impy4;
// z - direction
edgez1 *= impz1;
edgez2 *= impz2;
edgez3 *= impz3;
edgez4 *= impz4;
// add the contributions
vertices_[vertexNo] = edgex1 + edgex2 + edgex3 + edgex4;
vertices_[vertexNo] += edgey1 + edgey2 + edgey3 + edgey4;
vertices_[vertexNo] += edgez1 + edgez2 + edgez3 + edgez4;
vertices_[vertexNo] /= 3.0;
vertices_[vertexNo] += corx1 + corx2 + corx3 + corx4;
vertices_[vertexNo] += cory1 + cory2 + cory3 + cory4;
vertices_[vertexNo] += corz1 + corz2 + corz3 + corz4;
}
}
}
}
// ************************************************************************* //

View File

@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Check the blockMesh topology
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
{
Info<< nl << "Check block mesh topology" << endl;
bool blockMeshOK = true;
const pointField& points = bm.points();
const faceList& faces = bm.faces();
const cellList& cells = bm.cells();
const polyPatchList& patches = bm.boundaryMesh();
label nBoundaryFaces=0;
forAll(cells, celli)
{
nBoundaryFaces += cells[celli].nFaces();
}
nBoundaryFaces -= 2*bm.nInternalFaces();
label nDefinedBoundaryFaces=0;
forAll(patches, patchi)
{
nDefinedBoundaryFaces += patches[patchi].size();
}
Info<< nl << tab << "Basic statistics" << endl;
Info<< tab << tab << "Number of internal faces : "
<< bm.nInternalFaces() << endl;
Info<< tab << tab << "Number of boundary faces : "
<< nBoundaryFaces << endl;
Info<< tab << tab << "Number of defined boundary faces : "
<< nDefinedBoundaryFaces << endl;
Info<< tab << tab << "Number of undefined boundary faces : "
<< nBoundaryFaces - nDefinedBoundaryFaces << endl;
if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
{
Info<< tab << tab << tab
<< "(Warning : only leave undefined the front and back planes "
<< "of 2D planar geometries!)" << endl;
}
Info<< nl << tab << "Checking patch -> block consistency" << endl;
forAll(patches, patchi)
{
const faceList& Patch = patches[patchi];
forAll(Patch, patchFacei)
{
const face& patchFace = Patch[patchFacei];
bool patchFaceOK = false;
forAll(cells, celli)
{
const labelList& cellFaces = cells[celli];
forAll(cellFaces, cellFacei)
{
if (patchFace == faces[cellFaces[cellFacei]])
{
patchFaceOK = true;
if
(
(
patchFace.normal(points)
& faces[cellFaces[cellFacei]].normal(points)
) < 0.0
)
{
Info<< tab << tab
<< "Face " << patchFacei
<< " of patch " << patchi
<< " (" << patches[patchi].name() << ")"
<< " points inwards"
<< endl;
blockMeshOK = false;
}
}
}
}
if (!patchFaceOK)
{
Info<< tab << tab
<< "Face " << patchFacei
<< " of patch " << patchi
<< " (" << patches[patchi].name() << ")"
<< " does not match any block faces" << endl;
blockMeshOK = false;
}
}
}
if (!blockMeshOK)
{
FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
<< "Block mesh topology incorrect, stopping mesh generation!"
<< exit(FatalError);
}
}
// ************************************************************************* //

View File

@ -1,60 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::labelList Foam::blockMesh::createBlockOffsets()
{
Info<< nl << "Creating block offsets" << endl;
blockMesh& blocks = *this;
nPoints_ = blocks[0].points().size();
nCells_ = blocks[0].cells().size();
labelList BlockOffsets(blocks.size());
BlockOffsets[0] = 0;
label blockLabel;
for (blockLabel=1; blockLabel<blocks.size(); blockLabel++)
{
nPoints_ += blocks[blockLabel].points().size();
nCells_ += blocks[blockLabel].cells().size();
BlockOffsets[blockLabel]
= BlockOffsets[blockLabel-1]
+ blocks[blockLabel-1].points().size();
}
return BlockOffsets;
}
// ************************************************************************* //

View File

@ -1,74 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
#include "cellModeller.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::cellShapeList Foam::blockMesh::createCells()
{
Info<< nl << "Creating cells" << endl;
PtrList<cellShape> cells(nCells_);
blockMesh& blocks = *this;
const cellModel& hex = *(cellModeller::lookup("hex"));
label cellLabel = 0;
forAll(blocks, blockLabel)
{
const labelListList& blockCells = blocks[blockLabel].cells();
forAll(blockCells, blockCellLabel)
{
labelList cellPoints(blockCells[blockCellLabel].size());
forAll(cellPoints, cellPointLabel)
{
cellPoints[cellPointLabel] =
mergeList_
[
blockCells[blockCellLabel][cellPointLabel]
+ blockOffsets_[blockLabel]
];
}
// Construct collapsed cell and all to list
cells.set(cellLabel, new cellShape(hex, cellPoints, true));
cellLabel++;
}
}
return cells;
}
// ************************************************************************* //

View File

@ -1,559 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::labelList Foam::blockMesh::createMergeList()
{
Info<< nl << "Creating merge list " << flush;
labelList MergeList(nPoints_, -1);
blockMesh& blocks = *this;
const pointField& blockPoints = topology().points();
const cellList& blockCells = topology().cells();
const faceList& blockFaces = topology().faces();
const labelList& faceOwnerBlocks = topology().faceOwner();
// For efficiency, create merge pairs in the first pass
labelListListList glueMergePairs(blockFaces.size());
const labelList& faceNeighbourBlocks = topology().faceNeighbour();
forAll(blockFaces, blockFaceLabel)
{
label blockPlabel = faceOwnerBlocks[blockFaceLabel];
const pointField& blockPpoints = blocks[blockPlabel].points();
const labelList& blockPfaces = blockCells[blockPlabel];
bool foundFace = false;
label blockPfaceLabel;
for
(
blockPfaceLabel = 0;
blockPfaceLabel < blockPfaces.size();
blockPfaceLabel++
)
{
if
(
blockFaces[blockPfaces[blockPfaceLabel]]
== blockFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
if (!foundFace)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Cannot find merge face for block " << blockPlabel
<< exit(FatalError);
};
const labelListList& blockPfaceFaces =
blocks[blockPlabel].boundaryPatches()[blockPfaceLabel];
labelListList& curPairs = glueMergePairs[blockFaceLabel];
curPairs.setSize(blockPfaceFaces.size());
// Calculate sqr of the merge tolerance as 1/10th of the min sqr
// point to point distance on the block face.
// At the same time merge collated points on the block's faces
// (removes boundary poles etc.)
// Collated points detected by initally taking a constant factor of
// the size of the block.
boundBox bb(blockCells[blockPlabel].points(blockFaces, blockPoints));
const scalar mergeSqrDist = SMALL*magSqr(bb.span());
// This is an N^2 algorithm
scalar sqrMergeTol = GREAT;
forAll(blockPfaceFaces, blockPfaceFaceLabel)
{
const labelList& blockPfaceFacePoints
= blockPfaceFaces[blockPfaceFaceLabel];
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel)
{
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel2)
{
if (blockPfaceFacePointLabel != blockPfaceFacePointLabel2)
{
scalar magSqrDist = magSqr
(
blockPpoints[blockPfaceFacePoints
[blockPfaceFacePointLabel]]
- blockPpoints[blockPfaceFacePoints
[blockPfaceFacePointLabel2]]
);
if (magSqrDist < mergeSqrDist)
{
label PpointLabel =
blockPfaceFacePoints[blockPfaceFacePointLabel]
+ blockOffsets_[blockPlabel];
label PpointLabel2 =
blockPfaceFacePoints[blockPfaceFacePointLabel2]
+ blockOffsets_[blockPlabel];
label minPP2 = min(PpointLabel, PpointLabel2);
if (MergeList[PpointLabel] != -1)
{
minPP2 = min(minPP2, MergeList[PpointLabel]);
}
if (MergeList[PpointLabel2] != -1)
{
minPP2 = min(minPP2, MergeList[PpointLabel2]);
}
MergeList[PpointLabel] = MergeList[PpointLabel2]
= minPP2;
}
else
{
sqrMergeTol = min(sqrMergeTol, magSqrDist);
}
}
}
}
}
sqrMergeTol /= 10.0;
if (topology().isInternalFace(blockFaceLabel))
{
label blockNlabel = faceNeighbourBlocks[blockFaceLabel];
const pointField& blockNpoints = blocks[blockNlabel].points();
const labelList& blockNfaces = blockCells[blockNlabel];
foundFace = false;
label blockNfaceLabel;
for
(
blockNfaceLabel = 0;
blockNfaceLabel < blockNfaces.size();
blockNfaceLabel++
)
{
if
(
blockFaces[blockNfaces[blockNfaceLabel]]
== blockFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
if (!foundFace)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Cannot find merge face for block " << blockNlabel
<< exit(FatalError);
};
const labelListList& blockNfaceFaces =
blocks[blockNlabel].boundaryPatches()[blockNfaceLabel];
if (blockPfaceFaces.size() != blockNfaceFaces.size())
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Inconsistent number of faces between block pair "
<< blockPlabel << " and " << blockNlabel
<< exit(FatalError);
}
bool found = false;
// N-squared point search over all points of all faces of
// master block over all point of all faces of slave block
forAll(blockPfaceFaces, blockPfaceFaceLabel)
{
const labelList& blockPfaceFacePoints
= blockPfaceFaces[blockPfaceFaceLabel];
labelList& cp = curPairs[blockPfaceFaceLabel];
cp.setSize(blockPfaceFacePoints.size());
cp = -1;
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel)
{
found = false;
forAll(blockNfaceFaces, blockNfaceFaceLabel)
{
const labelList& blockNfaceFacePoints
= blockNfaceFaces[blockNfaceFaceLabel];
forAll(blockNfaceFacePoints, blockNfaceFacePointLabel)
{
if
(
magSqr
(
blockPpoints
[blockPfaceFacePoints[blockPfaceFacePointLabel]]
- blockNpoints
[blockNfaceFacePoints[blockNfaceFacePointLabel]]
) < sqrMergeTol
)
{
// Found a new pair
found = true;
cp[blockPfaceFacePointLabel] =
blockNfaceFacePoints[blockNfaceFacePointLabel];
label PpointLabel =
blockPfaceFacePoints[blockPfaceFacePointLabel]
+ blockOffsets_[blockPlabel];
label NpointLabel =
blockNfaceFacePoints[blockNfaceFacePointLabel]
+ blockOffsets_[blockNlabel];
label minPN = min(PpointLabel, NpointLabel);
if (MergeList[PpointLabel] != -1)
{
minPN = min(minPN, MergeList[PpointLabel]);
}
if (MergeList[NpointLabel] != -1)
{
minPN = min(minPN, MergeList[NpointLabel]);
}
MergeList[PpointLabel] = MergeList[NpointLabel]
= minPN;
}
}
}
}
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel)
{
if (cp[blockPfaceFacePointLabel] == -1)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Inconsistent point locations between block pair "
<< blockPlabel << " and " << blockNlabel << nl
<< " probably due to inconsistent grading."
<< exit(FatalError);
}
}
}
}
}
const faceList::subList blockInternalFaces
(
blockFaces,
topology().nInternalFaces()
);
bool changedPointMerge = false;
label nPasses = 0;
do
{
changedPointMerge = false;
nPasses++;
forAll(blockInternalFaces, blockFaceLabel)
{
label blockPlabel = faceOwnerBlocks[blockFaceLabel];
label blockNlabel = faceNeighbourBlocks[blockFaceLabel];
const labelList& blockPfaces = blockCells[blockPlabel];
const labelList& blockNfaces = blockCells[blockNlabel];
const labelListList& curPairs = glueMergePairs[blockFaceLabel];
bool foundFace = false;
label blockPfaceLabel;
for
(
blockPfaceLabel = 0;
blockPfaceLabel < blockPfaces.size();
blockPfaceLabel++
)
{
if
(
blockFaces[blockPfaces[blockPfaceLabel]]
== blockInternalFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
foundFace = false;
label blockNfaceLabel;
for
(
blockNfaceLabel = 0;
blockNfaceLabel < blockNfaces.size();
blockNfaceLabel++
)
{
if
(
blockFaces[blockNfaces[blockNfaceLabel]]
== blockInternalFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
const labelListList& blockPfaceFaces =
blocks[blockPlabel].boundaryPatches()[blockPfaceLabel];
forAll(blockPfaceFaces, blockPfaceFaceLabel)
{
const labelList& blockPfaceFacePoints
= blockPfaceFaces[blockPfaceFaceLabel];
const labelList& cp = curPairs[blockPfaceFaceLabel];
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel)
{
label PpointLabel =
blockPfaceFacePoints[blockPfaceFacePointLabel]
+ blockOffsets_[blockPlabel];
label NpointLabel =
cp[blockPfaceFacePointLabel]
+ blockOffsets_[blockNlabel];
if
(
MergeList[PpointLabel]
!= MergeList[NpointLabel]
)
{
changedPointMerge = true;
MergeList[PpointLabel]
= MergeList[NpointLabel]
= min
(
MergeList[PpointLabel],
MergeList[NpointLabel]
);
}
}
}
}
Info << "." << flush;
if (nPasses > 100)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Point merging failed after max number of passes."
<< abort(FatalError);
}
}
while (changedPointMerge);
Info << endl;
forAll(blockInternalFaces, blockFaceLabel)
{
label blockPlabel = faceOwnerBlocks[blockFaceLabel];
label blockNlabel = faceNeighbourBlocks[blockFaceLabel];
const labelList& blockPfaces = blockCells[blockPlabel];
const labelList& blockNfaces = blockCells[blockNlabel];
const pointField& blockPpoints = blocks[blockPlabel].points();
const pointField& blockNpoints = blocks[blockNlabel].points();
bool foundFace = false;
label blockPfaceLabel;
for
(
blockPfaceLabel = 0;
blockPfaceLabel < blockPfaces.size();
blockPfaceLabel++
)
{
if
(
blockFaces[blockPfaces[blockPfaceLabel]]
== blockInternalFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
if (!foundFace)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Cannot find merge face for block " << blockPlabel
<< exit(FatalError);
};
foundFace = false;
label blockNfaceLabel;
for
(
blockNfaceLabel = 0;
blockNfaceLabel < blockNfaces.size();
blockNfaceLabel++
)
{
if
(
blockFaces[blockNfaces[blockNfaceLabel]]
== blockInternalFaces[blockFaceLabel]
)
{
foundFace = true;
break;
}
}
if (!foundFace)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Cannot find merge face for block " << blockNlabel
<< exit(FatalError);
};
const labelListList& blockPfaceFaces =
blocks[blockPlabel].boundaryPatches()[blockPfaceLabel];
const labelListList& blockNfaceFaces =
blocks[blockNlabel].boundaryPatches()[blockNfaceLabel];
forAll(blockPfaceFaces, blockPfaceFaceLabel)
{
const labelList& blockPfaceFacePoints
= blockPfaceFaces[blockPfaceFaceLabel];
forAll(blockPfaceFacePoints, blockPfaceFacePointLabel)
{
label PpointLabel =
blockPfaceFacePoints[blockPfaceFacePointLabel]
+ blockOffsets_[blockPlabel];
if (MergeList[PpointLabel] == -1)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Unable to merge point "
<< blockPfaceFacePointLabel
<< ' ' << blockPpoints[blockPfaceFacePointLabel]
<< " of face "
<< blockPfaceLabel
<< " of block "
<< blockPlabel
<< exit(FatalError);
}
}
}
forAll(blockNfaceFaces, blockNfaceFaceLabel)
{
const labelList& blockNfaceFacePoints
= blockNfaceFaces[blockNfaceFaceLabel];
forAll(blockNfaceFacePoints, blockNfaceFacePointLabel)
{
label NpointLabel =
blockNfaceFacePoints[blockNfaceFacePointLabel]
+ blockOffsets_[blockNlabel];
if (MergeList[NpointLabel] == -1)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "unable to merge point "
<< blockNfaceFacePointLabel
<< ' ' << blockNpoints[blockNfaceFacePointLabel]
<< " of face "
<< blockNfaceLabel
<< " of block "
<< blockNlabel
<< exit(FatalError);
}
}
}
}
// sort merge list to return new point label (in new shorter list)
// given old point label
label newPointLabel = 0;
forAll(MergeList, pointLabel)
{
if (MergeList[pointLabel] > pointLabel)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "ouch" << exit(FatalError);
}
if
(
(MergeList[pointLabel] == -1)
|| MergeList[pointLabel] == pointLabel
)
{
MergeList[pointLabel] = newPointLabel;
newPointLabel++;
}
else
{
MergeList[pointLabel] = MergeList[MergeList[pointLabel]];
}
}
nPoints_ = newPointLabel;
return MergeList;
}
// ************************************************************************* //

View File

@ -1,171 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::faceList Foam::blockMesh::createPatchFaces
(
const polyPatch& patchTopologyFaces
)
{
blockMesh& blocks = *this;
labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
label nFaces=0;
forAll(patchTopologyFaces, patchTopologyFaceLabel)
{
label blockLabel = blockLabels[patchTopologyFaceLabel];
faceList blockFaces
(
blocks[blockLabel].blockDef().blockShape().faces()
);
forAll(blockFaces, blockFaceLabel)
{
if
(
blockFaces[blockFaceLabel]
== patchTopologyFaces[patchTopologyFaceLabel]
)
{
nFaces +=
blocks[blockLabel].boundaryPatches()[blockFaceLabel].size();
}
}
}
faceList patchFaces(nFaces);
face quadFace(4);
label faceLabel = 0;
forAll(patchTopologyFaces, patchTopologyFaceLabel)
{
label blockLabel = blockLabels[patchTopologyFaceLabel];
faceList blockFaces
(
blocks[blockLabel].blockDef().blockShape().faces()
);
forAll(blockFaces, blockFaceLabel)
{
if
(
blockFaces[blockFaceLabel]
== patchTopologyFaces[patchTopologyFaceLabel]
)
{
const labelListList& blockPatchFaces =
blocks[blockLabel].boundaryPatches()[blockFaceLabel];
forAll(blockPatchFaces, blockFaceLabel)
{
// Lookup the face points
// and collapse duplicate point labels
quadFace[0] =
mergeList_
[
blockPatchFaces[blockFaceLabel][0]
+ blockOffsets_[blockLabel]
];
label nUnique = 1;
for
(
label facePointLabel = 1;
facePointLabel < 4;
facePointLabel++
)
{
quadFace[nUnique] =
mergeList_
[
blockPatchFaces[blockFaceLabel][facePointLabel]
+ blockOffsets_[blockLabel]
];
if (quadFace[nUnique] != quadFace[nUnique-1])
{
nUnique++;
}
}
if (quadFace[nUnique-1] == quadFace[0])
{
nUnique--;
}
if (nUnique == 4)
{
patchFaces[faceLabel++] = quadFace;
}
else if (nUnique == 3)
{
patchFaces[faceLabel++] = face
(
labelList::subList(quadFace, 3)
);
}
// else the face has collapsed to an edge or point
}
}
}
}
patchFaces.setSize(faceLabel);
return patchFaces;
}
Foam::faceListList Foam::blockMesh::createPatches()
{
Info<< "\nCreating patches\n";
const polyPatchList& patchTopologies = topology().boundaryMesh();
faceListList patches(patchTopologies.size());
forAll(patchTopologies, patchLabel)
{
patches[patchLabel] =
createPatchFaces(patchTopologies[patchLabel]);
}
return patches;
}
// ************************************************************************* //

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
{
blockMesh& blocks = *this;
scalar scaleFactor = 1.0;
// optional 'convertToMeters' (or 'scale'?)
if (!dict.readIfPresent("convertToMeters", scaleFactor))
{
dict.readIfPresent("scale", scaleFactor);
}
Info<< nl << "Creating points with scale " << scaleFactor << endl;
pointField points(nPoints_);
forAll(blocks, blockLabel)
{
const pointField& blockPoints = blocks[blockLabel].points();
forAll(blockPoints, blockPointLabel)
{
points
[
mergeList_
[
blockPointLabel
+ blockOffsets_[blockLabel]
]
] = scaleFactor * blockPoints[blockPointLabel];
}
}
return points;
}
// ************************************************************************* //

View File

@ -1,656 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "blockMesh.H"
#include "Time.H"
#include "preservePatchTypes.H"
#include "emptyPolyPatch.H"
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool Foam::blockMesh::blockLabelsOK
(
const label blockLabel,
const pointField& points,
const cellShape& blockShape
)
{
bool ok = true;
forAll(blockShape, blockI)
{
if (blockShape[blockI] < 0)
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::blockLabelsOK"
"(const label blockLabel, const pointField& points, "
"const cellShape& blockShape)"
) << "block " << blockLabel
<< " point label " << blockShape[blockI]
<< " less than zero" << endl;
}
else if (blockShape[blockI] >= points.size())
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::blockLabelsOK"
"(const label blockLabel, const pointField& points, "
"const cellShape& blockShape)"
) << "block " << blockLabel
<< " point label " << blockShape[blockI]
<< " larger than " << points.size() - 1
<< " the largest defined point label" << endl;
}
}
return ok;
}
bool Foam::blockMesh::patchLabelsOK
(
const label patchLabel,
const pointField& points,
const faceList& patchFaces
)
{
bool ok = true;
forAll(patchFaces, faceI)
{
const labelList& f = patchFaces[faceI];
forAll(f, fp)
{
if (f[fp] < 0)
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::patchLabelsOK(...)"
) << "patch " << patchLabel
<< " face " << faceI
<< " point label " << f[fp]
<< " less than zero" << endl;
}
else if (f[fp] >= points.size())
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::patchLabelsOK(...)"
) << "patch " << patchLabel
<< " face " << faceI
<< " point label " << f[fp]
<< " larger than " << points.size() - 1
<< " the largest defined point label" << endl;
}
}
}
return ok;
}
bool Foam::blockMesh::readPatches
(
const dictionary& meshDescription,
const pointField& tmpBlockPoints,
faceListList& tmpBlocksPatches,
wordList& patchNames,
wordList& patchTypes,
wordList& nbrPatchNames
)
{
bool topologyOK = true;
ITstream& patchStream(meshDescription.lookup("patches"));
// read number of patches in mesh
label nPatches = 0;
token firstToken(patchStream);
if (firstToken.isLabel())
{
nPatches = firstToken.labelToken();
tmpBlocksPatches.setSize(nPatches);
patchNames.setSize(nPatches);
patchTypes.setSize(nPatches);
nbrPatchNames.setSize(nPatches);
}
else
{
patchStream.putBack(firstToken);
}
// Read beginning of blocks
patchStream.readBegin("patches");
nPatches = 0;
token lastToken(patchStream);
while
(
!(
lastToken.isPunctuation()
&& lastToken.pToken() == token::END_LIST
)
)
{
if (tmpBlocksPatches.size() <= nPatches)
{
tmpBlocksPatches.setSize(nPatches + 1);
patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
nbrPatchNames.setSize(nPatches + 1);
}
patchStream.putBack(lastToken);
patchStream
>> patchTypes[nPatches]
>> patchNames[nPatches];
// Read optional neighbour patch name
if (patchTypes[nPatches] == cyclicPolyPatch::typeName)
{
patchStream >> lastToken;
if (lastToken.isWord())
{
nbrPatchNames[nPatches] = lastToken.wordToken();
}
else
{
patchStream.putBack(lastToken);
}
}
// Read patch faces
patchStream >> tmpBlocksPatches[nPatches];
// Catch multiple patches asap.
for (label i = 0; i < nPatches; i++)
{
if (patchNames[nPatches] == patchNames[i])
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Duplicate patch " << patchNames[nPatches]
<< " at line " << patchStream.lineNumber()
<< ". Exiting !" << nl
<< exit(FatalError);
}
}
topologyOK = topologyOK && patchLabelsOK
(
nPatches,
tmpBlockPoints,
tmpBlocksPatches[nPatches]
);
nPatches++;
// Split old style cyclics
if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName)
{
if (nbrPatchNames[nPatches] == word::null)
{
word halfA = patchNames[nPatches-1] + "_half0";
word halfB = patchNames[nPatches-1] + "_half1";
WarningIn("blockMesh::createTopology(IOdictionary&)")
<< "Old-style cyclic definition."
<< " Splitting patch "
<< patchNames[nPatches-1] << " into two halves "
<< halfA << " and " << halfB << endl
<< " Alternatively use new syntax "
<< " cyclic <name> <neighbourname> <faces>" << endl;
// Add extra patch
if (tmpBlocksPatches.size() <= nPatches)
{
tmpBlocksPatches.setSize(nPatches + 1);
patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
nbrPatchNames.setSize(nPatches + 1);
}
patchNames[nPatches-1] = halfA;
nbrPatchNames[nPatches-1] = halfB;
patchTypes[nPatches] = patchTypes[nPatches-1];
patchNames[nPatches] = halfB;
nbrPatchNames[nPatches] = halfA;
// Split faces
if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0)
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Size of cyclic faces is not a multiple of 2 :"
<< tmpBlocksPatches[nPatches-1]
<< exit(FatalError);
}
label sz = tmpBlocksPatches[nPatches-1].size()/2;
faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true);
tmpBlocksPatches[nPatches-1] = faceList
(
SubList<face>(unsplitFaces, sz)
);
tmpBlocksPatches[nPatches] = faceList
(
SubList<face>(unsplitFaces, sz, sz)
);
nPatches++;
}
}
patchStream >> lastToken;
}
patchStream.putBack(lastToken);
// Read end of blocks
patchStream.readEnd("patches");
return topologyOK;
}
bool Foam::blockMesh::readBoundary
(
const dictionary& meshDescription,
const pointField& tmpBlockPoints,
faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts
)
{
bool topologyOK = true;
// Read like boundary file
const PtrList<entry> patchesInfo
(
meshDescription.lookup("boundary")
);
tmpBlocksPatches.setSize(patchesInfo.size());
patchDicts.setSize(patchesInfo.size());
forAll(tmpBlocksPatches, patchI)
{
const entry& patchInfo = patchesInfo[patchI];
// Construct dictionary and add name
patchDicts.set(patchI, new dictionary(patchInfo.dict()));
patchDicts[patchI].set("name", patchInfo.keyword());
// Read block faces
patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI];
topologyOK = topologyOK && patchLabelsOK
(
patchI,
tmpBlockPoints,
tmpBlocksPatches[patchI]
);
}
return topologyOK;
}
void Foam::blockMesh::createCellShapes
(
const pointField& tmpBlockPoints,
PtrList<cellShape>& tmpBlockCells
)
{
const blockMesh& blocks = *this;
tmpBlockCells.setSize(blocks.size());
forAll(blocks, blockLabel)
{
tmpBlockCells.set
(
blockLabel,
new cellShape(blocks[blockLabel].blockDef().blockShape())
);
if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0)
{
WarningIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "negative volume block : " << blockLabel
<< ", probably defined inside-out" << endl;
}
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
{
bool topologyOK = true;
blockMesh& blocks = *this;
word defaultPatchName = "defaultFaces";
word defaultPatchType = emptyPolyPatch::typeName;
// get names/types for the unassigned patch faces
// this is a bit heavy handed (and ugly), but there is currently
// no easy way to rename polyMesh patches subsequently
if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch"))
{
dictPtr->readIfPresent("name", defaultPatchName);
dictPtr->readIfPresent("type", defaultPatchType);
}
Info<< nl << "Creating blockCorners" << endl;
// create blockCorners
pointField tmpBlockPoints(meshDescription.lookup("vertices"));
if (meshDescription.found("edges"))
{
// read number of non-linear edges in mesh
Info<< nl << "Creating curved edges" << endl;
ITstream& edgesStream(meshDescription.lookup("edges"));
label nEdges = 0;
token firstToken(edgesStream);
if (firstToken.isLabel())
{
nEdges = firstToken.labelToken();
edges_.setSize(nEdges);
}
else
{
edgesStream.putBack(firstToken);
}
// Read beginning of edges
edgesStream.readBegin("edges");
nEdges = 0;
token lastToken(edgesStream);
while
(
!(
lastToken.isPunctuation()
&& lastToken.pToken() == token::END_LIST
)
)
{
if (edges_.size() <= nEdges)
{
edges_.setSize(nEdges + 1);
}
edgesStream.putBack(lastToken);
edges_.set
(
nEdges,
curvedEdge::New(tmpBlockPoints, edgesStream)
);
nEdges++;
edgesStream >> lastToken;
}
edgesStream.putBack(lastToken);
// Read end of edges
edgesStream.readEnd("edges");
}
else
{
Info<< nl << "There are no non-linear edges" << endl;
}
Info<< nl << "Creating blocks" << endl;
{
ITstream& blockDescriptorStream(meshDescription.lookup("blocks"));
// read number of blocks in mesh
label nBlocks = 0;
token firstToken(blockDescriptorStream);
if (firstToken.isLabel())
{
nBlocks = firstToken.labelToken();
blocks.setSize(nBlocks);
}
else
{
blockDescriptorStream.putBack(firstToken);
}
// Read beginning of blocks
blockDescriptorStream.readBegin("blocks");
nBlocks = 0;
token lastToken(blockDescriptorStream);
while
(
!(
lastToken.isPunctuation()
&& lastToken.pToken() == token::END_LIST
)
)
{
if (blocks.size() <= nBlocks)
{
blocks.setSize(nBlocks + 1);
}
blockDescriptorStream.putBack(lastToken);
blocks.set
(
nBlocks,
new block
(
blockDescriptor
(
tmpBlockPoints,
edges_,
blockDescriptorStream
)
)
);
topologyOK = topologyOK && blockLabelsOK
(
nBlocks,
tmpBlockPoints,
blocks[nBlocks].blockDef().blockShape()
);
nBlocks++;
blockDescriptorStream >> lastToken;
}
blockDescriptorStream.putBack(lastToken);
// Read end of blocks
blockDescriptorStream.readEnd("blocks");
}
polyMesh* blockMeshPtr = NULL;
Info<< nl << "Creating patches" << endl;
if (meshDescription.found("patches"))
{
Info<< nl << "Reading patches section" << endl;
faceListList tmpBlocksPatches;
wordList patchNames;
wordList patchTypes;
wordList nbrPatchNames;
topologyOK = topologyOK && readPatches
(
meshDescription,
tmpBlockPoints,
tmpBlocksPatches,
patchNames,
patchTypes,
nbrPatchNames
);
if (!topologyOK)
{
FatalErrorIn("blockMesh::createTopology(IOdictionary&)")
<< "Cannot create mesh due to errors in topology, exiting !"
<< nl << exit(FatalError);
}
Info<< nl << "Creating block mesh topology" << endl;
PtrList<cellShape> tmpBlockCells(blocks.size());
createCellShapes(tmpBlockPoints, tmpBlockCells);
Info<< nl << "Reading physicalType from existing boundary file" << endl;
wordList patchPhysicalTypes(tmpBlocksPatches.size());
preservePatchTypes
(
meshDescription.time(),
meshDescription.time().constant(),
polyMesh::meshSubDir,
patchNames,
patchTypes,
defaultPatchName,
defaultPatchType,
patchPhysicalTypes
);
blockMeshPtr = new polyMesh
(
IOobject
(
"blockMesh",
meshDescription.time().constant(),
meshDescription.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
xferMove(tmpBlockPoints),
tmpBlockCells,
tmpBlocksPatches,
patchNames,
patchTypes,
defaultPatchName,
defaultPatchType,
patchPhysicalTypes
);
}
else if (meshDescription.found("boundary"))
{
faceListList tmpBlocksPatches;
PtrList<dictionary> patchDicts;
topologyOK = topologyOK && readBoundary
(
meshDescription,
tmpBlockPoints,
tmpBlocksPatches,
patchDicts
);
if (!topologyOK)
{
FatalErrorIn("blockMesh::createTopology(IOdictionary&)")
<< "Cannot create mesh due to errors in topology, exiting !"
<< nl << exit(FatalError);
}
Info<< nl << "Creating block mesh topology" << endl;
PtrList<cellShape> tmpBlockCells(blocks.size());
createCellShapes(tmpBlockPoints, tmpBlockCells);
blockMeshPtr = new polyMesh
(
IOobject
(
"blockMesh",
meshDescription.time().constant(),
meshDescription.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
xferMove(tmpBlockPoints),
tmpBlockCells,
tmpBlocksPatches,
patchDicts,
defaultPatchName,
defaultPatchType
);
}
checkBlockMesh(*blockMeshPtr);
return blockMeshPtr;
}
// ************************************************************************* //

View File

@ -1,55 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::curvedEdgeList
Description
\*---------------------------------------------------------------------------*/
#ifndef curvedEdgeList_H
#define curvedEdgeList_H
#include "curvedEdge.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef PtrList<curvedEdge> curvedEdgeList;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,158 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
BSpline : cubic spline going through all the knots
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "BSpline.H"
#include "simpleMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
pointField BSpline::findKnots
(
const pointField& allknots,
const vector& fstend,
const vector& sndend
)
{
label newnKnots(allknots.size() + 2);
label NKnots(allknots.size());
pointField newknots(newnKnots);
// set up 1/6 and 2/3 which are the matrix elements throughout most
// of the matrix
register scalar oneSixth = 1.0/6.0;
register scalar twoThird = 2.0/3.0;
simpleMatrix<vector> M(newnKnots);
// set up the matrix
M[0][0] = -0.5*scalar(NKnots - 1);
M[0][2] = 0.5*scalar(NKnots - 1);
for (register label i=1; i<newnKnots-1; i++)
{
M[i][i-1] = oneSixth;
M[i][i] = twoThird;
M[i][i+1] = oneSixth;
}
M[newnKnots - 1][newnKnots - 3] = -0.5*scalar(NKnots - 1);
M[newnKnots - 1][newnKnots - 1] = 0.5*scalar(NKnots - 1);
// set up the vector
for (label i=1; i<=NKnots; i++)
{
M.source()[i] = allknots[i-1];
}
// set the gradients at the two ends
if (mag(fstend)<1e-8)
{
// set to the default : forward differences on the end knots
M.source()[0] = allknots[1] - allknots[0];
M.source()[0] /= mag(M.source()[0]);
M.source()[NKnots+1] = M.source()[NKnots-1] - M.source()[NKnots];
M.source()[NKnots+1] /= mag(M.source()[NKnots+1]);
}
else
{
// set to the gradient vectors provided
M.source()[0] = fstend/mag(fstend);
M.source()[NKnots+1] = sndend/mag(sndend);
}
// invert the equation to find the control knots
newknots = M.solve();
return newknots;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
BSpline::BSpline(const pointField& Knots)
:
spline(findKnots(Knots))
{}
// Construct from components
BSpline::BSpline
(
const pointField& Knots,
const vector& fstend,
const vector& sndend
)
:
spline(findKnots(Knots, fstend, sndend))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return the real position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector BSpline::realPosition(scalar mu)
{
return spline::position(mu);
}
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector BSpline::position(const scalar mu) const
{
return spline::position((1.0/(nKnots() - 1))*(1.0 + mu*(nKnots() - 3)));
}
//- Return the length of the curve
scalar BSpline::length() const
{
notImplemented("BSpline::length() const");
return 1.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::BSpline
Description
BSpline : cubic spline going through all the knots
SourceFiles
BSpline.C
\*---------------------------------------------------------------------------*/
#ifndef BSpline_H
#define BSpline_H
#include "spline.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class BSpline Declaration
\*---------------------------------------------------------------------------*/
class BSpline
:
public spline
{
// Private member functions
scalar remap(const scalar&);
pointField findKnots
(
const pointField&,
const vector& fstend = vector::zero,
const vector& sndend = vector::zero
);
public:
// Constructors
//- Construct from components
BSpline(const pointField& knots);
//- Construct from components
BSpline
(
const pointField& knots,
const vector& fstend,
const vector& sndend
);
// Member Functions
//- Return the real position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector realPosition(scalar lambda);
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar lambda) const;
//- Return the length of the curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,171 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
circumference
\*---------------------------------------------------------------------------*/
#include "arcEdge.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(arcEdge, 0);
// Add the curvedEdge constructor functions to the hash tables
addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::cylindricalCS Foam::arcEdge::calcAngle()
{
vector a = p2_ - p1_;
vector b = p3_ - p1_;
// find centre of arcEdge
scalar asqr = a & a;
scalar bsqr = b & b;
scalar adotb = a & b;
scalar denom = asqr*bsqr - adotb*adotb;
if (mag(denom) < VSMALL)
{
FatalErrorIn("cylindricalCS arcEdge::calcAngle()")
<< "Invalid arc definition - are the points co-linear? Denom ="
<< denom
<< abort(FatalError);
}
scalar fact = 0.5*(bsqr - adotb)/denom;
vector centre = 0.5*a + fact*((a ^ b) ^ a);
centre += p1_;
// find position vectors w.r.t. the arcEdge centre
vector r1(p1_ - centre);
vector r2(p2_ - centre);
vector r3(p3_ - centre);
// find angles
scalar tmp = (r3&r1)/(mag(r3)*mag(r1));
angle_ = acos(tmp)*180.0/mathematicalConstant::pi;
// check if the vectors define an exterior or an interior arcEdge
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) angle_ = 360 - angle_;
vector tempAxis(0.0,0.0,0.0);
if (angle_ <= 180.0)
{
tempAxis = r1 ^ r3;
if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001) tempAxis = r1 ^ r2;
}
else
{
tempAxis = r3 ^ r1;
}
radius_ = mag(r3);
// set up and return the local coordinate system
return cylindricalCS("tmpCS", centre, tempAxis, r1);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::arcEdge::arcEdge
(
const pointField& points,
const label start,
const label end,
const vector& P2
)
:
curvedEdge(points, start, end),
p1_(points_[start_]),
p2_(P2),
p3_(points_[end_]),
cs_(calcAngle())
{}
// Construct from Istream
Foam::arcEdge::arcEdge(const pointField& points, Istream& is)
:
curvedEdge(points, is),
p1_(points_[start_]),
p2_(is),
p3_(points_[end_]),
cs_(calcAngle())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::vector Foam::arcEdge::position(const scalar lambda) const
{
if (lambda < 0 || lambda > 1)
{
FatalErrorIn("arcEdge::position(const scalar lambda) const")
<< "Parameter out of range, lambda = " << lambda
<< abort(FatalError);
}
if (lambda < SMALL)
{
return p1_;
}
else if (lambda > 1-SMALL)
{
return p3_;
}
else
{
return cs_.globalPosition(vector(radius_, lambda*angle_, 0.0));
}
}
//- Return the length of the curve
Foam::scalar Foam::arcEdge::length() const
{
return angle_*radius_*mathematicalConstant::pi/180.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -1,109 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::arcEdge
Description
arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
circumference
SourceFiles
arcEdge.C
\*---------------------------------------------------------------------------*/
#ifndef arcEdge_H
#define arcEdge_H
#include "curvedEdge.H"
#include "cylindricalCS.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class arcEdge Declaration
\*---------------------------------------------------------------------------*/
class arcEdge
:
public curvedEdge
{
// Private data
vector p1_, p2_, p3_;
scalar angle_;
scalar radius_;
cylindricalCS cs_;
cylindricalCS calcAngle();
public:
//- Runtime type information
TypeName("arc");
// Constructors
//- Construct from components
arcEdge
(
const pointField& points,
const label start, const label end,
const vector&
);
//- Construct from Istream setting pointsList
arcEdge(const pointField& points, Istream&);
// Destructor
virtual ~arcEdge(){}
// Member Functions
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar) const;
//- Return the length of the curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,166 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
library functions that will define a curvedEdge in space
parameterised for 0<lambda<1 from the beginning
point to the end point.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "curvedEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(curvedEdge, 0);
defineRunTimeSelectionTable(curvedEdge, Istream);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
curvedEdge::curvedEdge
(
const pointField& points,
const label start,
const label end
)
:
points_(points),
start_(start),
end_(end)
{}
// Construct from Istream
curvedEdge::curvedEdge(const pointField& points, Istream& is)
:
points_(points),
start_(readLabel(is)),
end_(readLabel(is))
{}
// Copy construct
curvedEdge::curvedEdge(const curvedEdge& c)
:
points_(c.points_),
start_(c.start_),
end_(c.end_)
{}
//- Clone function
autoPtr<curvedEdge> curvedEdge::clone() const
{
notImplemented("curvedEdge::clone() const");
return autoPtr<curvedEdge>(NULL);
}
//- New function which constructs and returns pointer to a curvedEdge
autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
{
if (debug)
{
Info<< "curvedEdge::New(const pointField&, Istream&) : "
<< "constructing curvedEdge"
<< endl;
}
word curvedEdgeType(is);
IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_
->find(curvedEdgeType);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
<< "Unknown curvedEdge type " << curvedEdgeType << endl << endl
<< "Valid curvedEdge types are" << endl
<< IstreamConstructorTablePtr_->toc()
<< abort(FatalError);
}
return autoPtr<curvedEdge>(cstrIter()(points, is));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return the complete knotList by adding the start and end points to the
// given list
pointField knotlist
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots
)
{
label listsize(otherknots.size() + 2);
pointField tmp(listsize);
tmp[0] = points[start];
for (register label i=1; i<listsize-1; i++)
{
tmp[i] = otherknots[i-1];
}
tmp[listsize-1] = points[end];
return tmp;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void curvedEdge::operator=(const curvedEdge&)
{
notImplemented("void curvedEdge::operator=(const curvedEdge&)");
}
Ostream& operator<<(Ostream& os, const curvedEdge& p)
{
os << p.start_ << tab << p.end_ << endl;
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::curvedEdge
Description
curvedEdges : library functions that will define a curvedEdge in space
parameterised for 0<lambda<1 from the beginning point to the end point.
This file contains the abstract base class curvedEdge.
SourceFiles
curvedEdge.C
\*---------------------------------------------------------------------------*/
#ifndef curvedEdges_H
#define curvedEdges_H
#include "pointField.H"
#include "typeInfo.H"
#include "HashTable.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class curvedEdge Declaration
\*---------------------------------------------------------------------------*/
class curvedEdge
{
protected:
// Protected data
const pointField& points_;
const label start_, end_;
public:
//- Runtime type information
TypeName("curvedEdge");
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
curvedEdge,
Istream,
(
const pointField& points,
Istream& is
),
(points, is)
);
// Constructors
//- Construct from components
curvedEdge
(
const pointField& points,
const label start,
const label end
);
//- Construct from Istream setting pointsList
curvedEdge(const pointField&, Istream&);
//- Copy construct
curvedEdge(const curvedEdge&);
//- Clone function
virtual autoPtr<curvedEdge> clone() const;
//- New function which constructs and returns pointer to a curvedEdge
static autoPtr<curvedEdge> New(const pointField&, Istream&);
// Destructor
virtual ~curvedEdge(){}
// Member Functions
//- Return label of start point
label start() const
{
return start_;
}
//- Return label of end point
label end() const
{
return end_;
}
//- Compare the given start and end points with those of this curve
bool compare(const label start, const label end) const
{
return
(
(start_ == start && end_ == end)
|| (start_ == end && end_ == start)
);
}
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
virtual vector position(const scalar) const = 0;
//- Return the length of the curve
virtual scalar length() const = 0;
// Member operators
void operator=(const curvedEdge&);
// Ostream operator
friend Ostream& operator<<(Ostream&, const curvedEdge&);
};
//- Return the complete knotList by adding the start and end points to the
// given list
pointField knotlist
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,97 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
lineDivide class : divides a line into segments
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "lineDivide.H"
#include "curvedEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
lineDivide::lineDivide(const curvedEdge& bc, const label n, const scalar xratio)
:
points_(n + 1),
divisions_(n + 1),
noPoints_(n)
{
scalar np(n);
scalar lambda(0.0);
if (xratio == 1.0)
{
scalar y(1.0/np);
for (label i=0; i<=noPoints_; i++)
{
lambda = scalar(i)/np;
points_[i] = bc.position(lambda);
divisions_[i] = y*i;
}
}
else
{
points_[0] = bc.position(0.0);
divisions_[0] = 0.0;
scalar xrpower = 1.0;
for (label i=1; i<=noPoints_; i++)
{
lambda = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, np));
points_[i] = bc.position(lambda);
divisions_[i] = lambda;
xrpower *= xratio;
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const pointField& lineDivide::points() const
{
return points_;
}
const scalarList& lineDivide::lambdaDivisions() const
{
return divisions_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,88 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::lineDivide
Description
lineDivide class : divides a line into segments
SourceFiles
lineDivide.C
\*---------------------------------------------------------------------------*/
#ifndef lineDivide_H
#define lineDivide_H
#include "pointField.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class curvedEdge;
/*---------------------------------------------------------------------------*\
Class lineDivide Declaration
\*---------------------------------------------------------------------------*/
class lineDivide
{
// Private data
pointField points_;
scalarList divisions_;
label noPoints_;
public:
// Constructors
//- Construct from components
lineDivide(const curvedEdge&, const label, const scalar = 1.0);
// Member Functions
//- Return the points
const pointField& points() const;
//- Return the list of lambda values
const scalarList& lambdaDivisions() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
line class : defines a straight line between the start point and the
end point
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "lineEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(lineEdge, 0);
// Add the curvedEdge constructor functions to the hash tables
curvedEdge::addIstreamConstructorToTable<lineEdge>
addLineEdgeIstreamConstructorToTable_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
lineEdge::lineEdge
(
const pointField& points,
const label start,
const label end
)
:
curvedEdge(points, start, end),
startPoint_(points_[start_]),
direction_(points_[end_] - points_[start_])
{}
// Construct from Istream
lineEdge::lineEdge(const pointField& points, Istream& is)
:
curvedEdge(points, is),
startPoint_(points_[start_]),
direction_(points_[end_] - points_[start_])
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vector lineEdge::position(const scalar lambda) const
{
if (lambda < 0 || lambda > 1)
{
FatalErrorIn("lineEdge::position(const scalar)")
<< "Parameter out of range, lambda = " << lambda
<< abort(FatalError);
}
return startPoint_ + lambda*direction_;
}
//- Return the length of the curve
scalar lineEdge::length() const
{
return mag(direction_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,137 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
polyLineEdge class : defines a curvedEdge in terms of a series of
straight line segments
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "polyLine.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// calcDistances generates the distances_ lookup table (cumulative
// distance along the line) from the individual vectors to the points
void polyLine::calcDistances()
{
distances_[0] = 0.0;
for (label i=1; i<distances_.size(); i++)
{
distances_[i] =
mag(controlPoints_[i] - controlPoints_[i-1])
+ distances_[i-1];
}
lineLength_ = distances_[distances_.size()-1];
for (label i=1; i<distances_.size(); i++)
{
distances_[i] /= lineLength_;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
polyLine::polyLine(const pointField& ps)
:
controlPoints_(ps),
distances_(ps.size())
{
if (ps.size())
{
calcDistances();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vector polyLine::position(const scalar lambda) const
{
// check range of lambda
if (lambda < 0 || lambda > 1)
{
FatalErrorIn("polyLine::position(const scalar)")
<< "Parameter out of range, "
<< "lambda = " << lambda
<< abort(FatalError);
}
// Quick calc of endpoints
if (lambda < SMALL)
{
return controlPoints_[0];
}
else if (lambda > 1 - SMALL)
{
return controlPoints_[controlPoints_.size()-1];
}
// search table of cumulative distance to find which linesegment we
// are on
label i(0);
do
{
i++;
} while (distances_[i] < lambda);
i--; // we overshot!
// construct position vector
scalar offsetDist =
(lambda - distances_[i])
/(distances_[i+1] - distances_[i]);
vector offsetV = controlPoints_[i+1] - controlPoints_[i];
return controlPoints_[i] + offsetDist*offsetV;
}
scalar polyLine::length() const
{
return lineLength_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,97 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::polyLine
Description
polyLine class : defines a curvedEdge in terms of a series of straight
line segments. This is the basic polyLine class which implements
just the line (no topology : its not derived from curvedEdge)
SourceFiles
polyLine.C
\*---------------------------------------------------------------------------*/
#ifndef polyLine_H
#define polyLine_H
#include "pointField.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class polyLine Declaration
\*---------------------------------------------------------------------------*/
class polyLine
{
protected:
// Protected data
pointField controlPoints_;
scalarList distances_;
scalar lineLength_;
// Protected member functions
void calcDistances();
public:
// Constructors
//- Construct from components
polyLine(const pointField& ps);
// Member Functions
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar) const;
//- Return the length of the curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,103 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::polyLineEdge
Description
polyLineEdge class : defines a curvedEdge in terms of a series of straight
line segments. This is the public face of polyLine
SourceFiles
polyLineEdge.C
\*---------------------------------------------------------------------------*/
#ifndef polyLineEdge_H
#define polyLineEdge_H
#include "curvedEdge.H"
#include "polyLine.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class polyLineEdge Declaration
\*---------------------------------------------------------------------------*/
class polyLineEdge
:
public curvedEdge,
public polyLine
{
public:
// Static data members
TypeName("polyLine");
// Constructors
//- Construct from components
polyLineEdge
(
const pointField& ps,
const label start,
const label end,
const pointField& otherpoints
);
//- Construct from Istream
polyLineEdge(const pointField& ps, Istream&);
// Destructor
virtual ~polyLineEdge(){}
// Member Functions
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar lambda) const;
//- Return the length of the curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,150 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "polySplineEdge.H"
#include "BSpline.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(polySplineEdge, 0);
// Add the curvedEdge constructor functions to the hash tables
addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// intervening : returns a list of the points making up the polyLineEdge
// which describes the spline. nbetweenKnots is the number of points
// placed between each knot : this ensures that the knot locations
// are retained as a subset of the polyLine points.
// note that the points are evenly spaced in the parameter mu, not
// in real space
Foam::pointField Foam::polySplineEdge::intervening
(
const pointField& otherknots,
const label nbetweenKnots,
const vector& fstend,
const vector& sndend
)
{
BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend);
label nSize(nsize(otherknots.size(), nbetweenKnots));
pointField ans(nSize);
label N = spl.nKnots();
scalar init = 1.0/(N - 1);
scalar interval = (N - scalar(3))/N;
interval /= otherknots.size() + 1;
interval /= nbetweenKnots + 1;
ans[0] = points_[start_];
register scalar index(init);
for (register label i=1; i<nSize-1; i++)
{
index += interval;
ans[i] = spl.realPosition(index);
}
ans[nSize-1] = points_[end_];
return ans;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polySplineEdge::polySplineEdge
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots,
const label nInterKnots
)
:
curvedEdge(points, start, end),
polyLine
(
intervening
(
otherknots,
nInterKnots,
vector::zero,
vector::zero
)
),
otherKnots_(otherknots)
{}
Foam::polySplineEdge::polySplineEdge
(
const pointField& points,
Istream& is
)
:
curvedEdge(points, is),
polyLine(pointField(0)),
otherKnots_(is)
{
label nInterKnots(20);
vector fstend(is);
vector sndend(is);
controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots));
distances_.setSize(controlPoints_.size());
controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend);
calcDistances();
Info<< polyLine::controlPoints_ << endl;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::vector Foam::polySplineEdge::position(const scalar mu) const
{
return polyLine::position(mu);
}
Foam::scalar Foam::polySplineEdge::length() const
{
return polyLine::length();
}
// ************************************************************************* //

View File

@ -1,122 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::polySplineEdge
Description
polySplineEdge class : representation of a spline via a polyLine
SourceFiles
polySplineEdge.C
\*---------------------------------------------------------------------------*/
#ifndef polySplineEdge_H
#define polySplineEdge_H
#include "curvedEdge.H"
#include "polyLine.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class polySplineEdge Declaration
\*---------------------------------------------------------------------------*/
class polySplineEdge
:
public curvedEdge,
public polyLine
{
// Private data
pointField otherKnots_;
// Private member functions
pointField intervening
(
const pointField& otherknots,
const label nbetweenKnots,
const vector&, const vector&
);
label nsize(const label otherknotsSize, const label nbetweenKnots)
{
return otherknotsSize*(1 + nbetweenKnots) + nbetweenKnots + 2;
}
public:
//- Runtime type information
TypeName("polySpline");
// Constructors
//- Construct from components
polySplineEdge
(
const pointField& ps,
const label start,
const label end,
const pointField& otherknots,
const label nInterKnots = 20
);
//- Construct from Istream setting pointsList
polySplineEdge(const pointField& points, Istream& is);
// Destructor
virtual ~polySplineEdge(){}
// Member Functions
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar mu) const;
//- Return the length of the curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,106 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
simpleSplineEdge : the actual access class for Bspline
\*---------------------------------------------------------------------------*/
#include "simpleSplineEdge.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(simpleSplineEdge, 0);
addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
simpleSplineEdge::simpleSplineEdge
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots
)
:
curvedEdge(points, start, end),
BSpline(knotlist(points, start, end, otherknots))
{}
// Construct from components
simpleSplineEdge::simpleSplineEdge
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots,
const vector& fstend,
const vector& sndend
)
:
curvedEdge(points, start, end),
BSpline(knotlist(points, start, end, otherknots), fstend, sndend)
{}
// Construct from Istream
simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
:
curvedEdge(points, is),
BSpline(knotlist(points, start_, end_, pointField(is)))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return the position of a point on the simple spline curve given by
// the parameter 0 <= lambda <= 1
vector simpleSplineEdge::position(const scalar mu) const
{
return BSpline::position(mu);
}
//- Return the length of the simple spline curve
scalar simpleSplineEdge::length() const
{
notImplemented("simpleSplineEdge::length() const");
return 1.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,113 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::simpleSplineEdge
Description
simpleSplineEdge : the actual access class for Bspline
SourceFiles
simpleSplineEdge.C
\*---------------------------------------------------------------------------*/
#ifndef simpleSplineEdge_H
#define simpleSplineEdge_H
#include "curvedEdge.H"
#include "BSpline.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class simpleSplineEdge Declaration
\*---------------------------------------------------------------------------*/
class simpleSplineEdge
:
public curvedEdge,
public BSpline
{
public:
//- Runtime type information
TypeName("simpleSpline");
// Constructors
//- Construct from components
simpleSplineEdge
(
const pointField& ps,
const label start,
const label end,
const pointField& otherknots
);
//- Construct from components
simpleSplineEdge
(
const pointField& points,
const label start,
const label end,
const pointField& otherknots,
const vector& fstend,
const vector& sndend
);
//- Construct from Istream setting pointsList
simpleSplineEdge(const pointField&, Istream&);
// Destructor
virtual ~simpleSplineEdge(){}
// Member Functions
//- Return the position of a point on the simple spline curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar mu) const;
//- Return the length of the simple spline curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,117 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
spline class : define a basic spline on nKnots knots - this
does not go anywhere near these knots (will act as a base type for
various splines that will have real uses)
\*---------------------------------------------------------------------------*/
#include "spline.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
spline::spline(const pointField& a)
:
knots_(a)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// function B : this is the blending function for constructing the
// spline
scalar spline::B(const scalar& tau) const
{
scalar value = 0.0;
if (tau>=2.0 || tau<=-2.0)
{
value = 0.0;
}
else if (tau<=-1.0)
{
value = pow((2.0 + tau),3.0)/6.0;
}
else if (tau<=0.0)
{
value = (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
}
else if (tau<=1.0)
{
value = (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
}
else if (tau<=2.0)
{
value = pow((2.0 - tau),3.0)/6.0;
}
else
{
FatalErrorIn("spline::B(const scalar&)")
<< "How the hell did we get here???, "
<< "tau = " << tau
<< abort(FatalError);
}
return value;
}
// position : returns the position along the spline corresponding to the
// variable mu1
vector spline::position(const scalar mu1) const
{
vector tmp(vector::zero);
for (register label i=0; i<knots_.size(); i++)
{
tmp += B((knots_.size() - 1)*mu1 - i)*knots_[i];
}
return tmp;
}
//- Return the length of the spline curve
scalar spline::length() const
{
notImplemented("spline::length() const");
return 1.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::spline
Description
spline class : define a basic spline on nKnots knots - this
does not go anywhere near these knots (will act as a base type for
various splines that will have real uses)
SourceFiles
spline.C
\*---------------------------------------------------------------------------*/
#ifndef spline_H
#define spline_H
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class spline Declaration
\*---------------------------------------------------------------------------*/
class spline
{
// Private data
//- The knots defining the spline
pointField knots_;
// Private member functions
//- Blending function for constructing spline
scalar B(const scalar&) const;
public:
// Constructors
//- Construct from components
spline(const pointField&);
// Member Functions
// Access
//- Return the number of knots in the spline
label nKnots() const
{
return knots_.size();
}
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar) const;
//- Return the length of the spline curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,146 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
from the list of curved edges creates a list
of edges that are not curved. It is assumed
that all other edges are straight lines
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockDescriptor.H"
#include "lineEdge.H"
#include "lineDivide.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar calcGexp(const scalar expRatio, const label dim)
{
if (dim == 1)
{
return 0.0;
}
else
{
return pow(expRatio, 1.0/(dim - 1));
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
{
// for all edges check the list of curved edges. If the edge is curved,
// add it to the list. If the edge is not found, create is as a line
bool found = false;
// set reference to the list of labels defining the block
const labelList& blockLabels = blockShape_;
// set reference to global list of points
const pointField blockPoints = blockShape_.points(blockMeshPoints_);
// x1
found = false;
forAll (curvedEdges_, nCEI)
{
if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end]))
{
found = true;
// check the orientation:
// if the starting point of the curve is the same as the starting
// point of the edge, do the parametrisation and pick up the points
if (blockLabels[start] == curvedEdges_[nCEI].start())
{
// calculate the geometric expension factor out of the
// expansion ratio
scalar gExp = calcGexp(expand_[edgeI], dim);
// divide the line
lineDivide divEdge(curvedEdges_[nCEI], dim, gExp);
edgePoints_[edgeI] = divEdge.points();
edgeWeights_[edgeI] = divEdge.lambdaDivisions();
}
else
{
// the curve has got the opposite orientation
scalar gExp = calcGexp(expand_[edgeI], dim);
// divide the line
lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL));
pointField p = divEdge.points();
scalarList d = divEdge.lambdaDivisions();
edgePoints_[edgeI].setSize(p.size());
edgeWeights_[edgeI].setSize(d.size());
label pMax = p.size() - 1;
forAll (p, pI)
{
edgePoints_[edgeI][pI] = p[pMax - pI];
edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI];
}
}
break;
}
}
if (!found)
{
// edge is a straight line
scalar gExp = calcGexp(expand_[edgeI], dim);
// divide the line
lineDivide divEdge
(
lineEdge(blockPoints, start, end),
dim,
gExp
);
edgePoints_[edgeI] = divEdge.points();
edgeWeights_[edgeI] = divEdge.lambdaDivisions();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,10 +1,14 @@
EXE_INC = \
-IextrudedMesh \
-IextrudeModel/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-ldynamicMesh \
-lextrudeModel

View File

@ -36,13 +36,14 @@ Description
#include "Time.H"
#include "dimensionedTypes.H"
#include "IFstream.H"
#include "faceMesh.H"
#include "polyTopoChange.H"
#include "polyTopoChanger.H"
#include "edgeCollapser.H"
#include "mathematicalConstants.H"
#include "globalMeshData.H"
#include "perfectInterface.H"
#include "addPatchCellLayer.H"
#include "fvMesh.H"
#include "MeshedSurfaces.H"
#include "extrudedMesh.H"
#include "extrudeModel.H"
@ -50,14 +51,165 @@ Description
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
enum ExtrudeMode
{
MESH,
PATCH,
SURFACE
};
template<>
const char* NamedEnum<ExtrudeMode, 3>::names[] =
{
"mesh",
"patch",
"surface"
};
static const NamedEnum<ExtrudeMode, 3> ExtrudeModeNames;
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
{
// Create dummy system/fv*
{
IOobject io
(
"fvSchemes",
mesh.time().system(),
regionName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk())
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
dictionary divDict;
dummyDict.add("divSchemes", divDict);
dictionary gradDict;
dummyDict.add("gradSchemes", gradDict);
dictionary laplDict;
dummyDict.add("laplacianSchemes", laplDict);
IOdictionary(io, dummyDict).regIOobject::write();
}
}
{
IOobject io
(
"fvSolution",
mesh.time().system(),
regionName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
if (!io.headerOk())
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
IOdictionary(io, dummyDict).regIOobject::write();
}
}
}
label findPatchID(const polyBoundaryMesh& patches, const word& name)
{
label patchID = patches.findPatchID(name);
if (patchID == -1)
{
FatalErrorIn("findPatchID(const polyBoundaryMesh&, const word&)")
<< "Cannot find patch " << name
<< " in the source mesh.\n"
<< "Valid patch names are " << patches.names()
<< exit(FatalError);
}
return patchID;
}
labelList patchFaces(const polyBoundaryMesh& patches, const wordList& names)
{
label n = 0;
forAll(names, i)
{
const polyPatch& pp = patches[findPatchID(patches, names[i])];
n += pp.size();
}
labelList faceLabels(n);
n = 0;
forAll(names, i)
{
const polyPatch& pp = patches[findPatchID(patches, names[i])];
forAll(pp, j)
{
faceLabels[n++] = pp.start()+j;
}
}
return faceLabels;
}
void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
{
const labelList& reverseMap = map.reverseFaceMap();
labelList newFaceLabels(faceLabels.size());
label newI = 0;
forAll(faceLabels, i)
{
label oldFaceI = faceLabels[i];
if (reverseMap[oldFaceI] >= 0)
{
newFaceLabels[newI++] = reverseMap[oldFaceI];
}
}
newFaceLabels.setSize(newI);
faceLabels.transfer(newFaceLabels);
}
// Main program:
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTimeExtruded.H"
autoPtr<extrudedMesh> meshPtr(NULL);
// Get optional regionName
word regionName;
word regionDir;
if (args.optionReadIfPresent("region", regionName))
{
regionDir = regionName;
Info<< "Create mesh " << regionName << " for time = "
<< runTimeExtruded.timeName() << nl << endl;
}
else
{
regionName = fvMesh::defaultRegion;
Info<< "Create mesh for time = "
<< runTimeExtruded.timeName() << nl << endl;
}
IOdictionary dict
(
@ -65,26 +217,57 @@ int main(int argc, char *argv[])
(
"extrudeProperties",
runTimeExtruded.constant(),
regionDir,
runTimeExtruded,
IOobject::MUST_READ
)
);
// Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict));
const word sourceType(dict.lookup("constructFrom"));
// Whether to flip normals
const Switch flipNormals(dict.lookup("flipNormals"));
autoPtr<faceMesh> fMesh;
// What to extrude
const ExtrudeMode mode = ExtrudeModeNames.read
(
dict.lookup("constructFrom")
);
if (sourceType == "patch")
// Generated mesh (one of either)
autoPtr<fvMesh> meshFromMesh;
autoPtr<polyMesh> meshFromSurface;
// Faces on front and back for stitching (in case of mergeFaces)
word frontPatchName;
labelList frontPatchFaces;
word backPatchName;
labelList backPatchFaces;
if (mode == PATCH || mode == MESH)
{
if (flipNormals)
{
FatalErrorIn(args.executable())
<< "Flipping normals not supported for extrusions from patch."
<< exit(FatalError);
}
fileName sourceCasePath(dict.lookup("sourceCase"));
sourceCasePath.expand();
fileName sourceRootDir = sourceCasePath.path();
fileName sourceCaseDir = sourceCasePath.name();
word patchName(dict.lookup("sourcePatch"));
wordList sourcePatches;
dict.lookup("sourcePatches") >> sourcePatches;
Info<< "Extruding patch " << patchName
if (sourcePatches.size() == 1)
{
frontPatchName = sourcePatches[0];
}
Info<< "Extruding patches " << sourcePatches
<< " on mesh " << sourceCasePath << nl
<< endl;
@ -94,31 +277,183 @@ int main(int argc, char *argv[])
sourceRootDir,
sourceCaseDir
);
#include "createPolyMesh.H"
#include "createMesh.H"
label patchID = mesh.boundaryMesh().findPatchID(patchName);
const polyBoundaryMesh& patches = mesh.boundaryMesh();
if (patchID == -1)
// Topo change container. Either copy an existing mesh or start
// with empty storage (number of patches only needed for checking)
autoPtr<polyTopoChange> meshMod
(
(
mode == MESH
? new polyTopoChange(mesh)
: new polyTopoChange(patches.size())
)
);
// Extrusion engine. Either adding to existing mesh or
// creating separate mesh.
addPatchCellLayer layerExtrude(mesh, (mode == MESH));
indirectPrimitivePatch extrudePatch
(
IndirectList<face>
(
mesh.faces(),
patchFaces(patches, sourcePatches)
),
mesh.points()
);
// Only used for addPatchCellLayer into new mesh
labelList exposedPatchIDs;
if (mode == PATCH)
{
FatalErrorIn(args.executable())
<< "Cannot find patch " << patchName
<< " in the source mesh.\n"
<< "Valid patch names are " << mesh.boundaryMesh().names()
<< exit(FatalError);
dict.lookup("exposedPatchName") >> backPatchName;
exposedPatchIDs.setSize
(
extrudePatch.size(),
findPatchID(patches, backPatchName)
);
}
const polyPatch& pp = mesh.boundaryMesh()[patchID];
fMesh.reset(new faceMesh(pp.localFaces(), pp.localPoints()));
pointField layer0Points(extrudePatch.nPoints());
pointField displacement(extrudePatch.nPoints());
forAll(displacement, pointI)
{
fileName surfName(runTime.path()/patchName + ".sMesh");
Info<< "Writing patch as surfaceMesh to "
<< surfName << nl << endl;
OFstream os(surfName);
os << fMesh() << nl;
const vector& patchNormal = extrudePatch.pointNormals()[pointI];
// layer0 point
layer0Points[pointI] = model()
(
extrudePatch.localPoints()[pointI],
patchNormal,
0
);
// layerN point
point extrudePt = model()
(
extrudePatch.localPoints()[pointI],
patchNormal,
model().nLayers()
);
displacement[pointI] = extrudePt - layer0Points[pointI];
}
if (flipNormals)
{
Info<< "Flipping faces." << nl << endl;
displacement = -displacement;
}
// Check if wedge (has layer0 different from original patch points)
// If so move the mesh to starting position.
if (gMax(mag(layer0Points-extrudePatch.localPoints())) > SMALL)
{
Info<< "Moving mesh to layer0 points since differ from original"
<< " points - this can happen for wedge extrusions." << nl
<< endl;
pointField newPoints(mesh.points());
forAll(extrudePatch.meshPoints(), i)
{
newPoints[extrudePatch.meshPoints()[i]] = layer0Points[i];
}
mesh.movePoints(newPoints);
}
// Layers per face
labelList nFaceLayers(extrudePatch.size(), model().nLayers());
// Layers per point
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
// Displacement for first layer
vectorField firstLayerDisp = displacement*model().sumThickness(1);
// Expansion ratio not used.
scalarField ratio(extrudePatch.nPoints(), 1.0);
layerExtrude.setRefinement
(
ratio, // expansion ratio
extrudePatch, // patch faces to extrude
exposedPatchIDs, // if new mesh: patches for exposed faces
nFaceLayers,
nPointLayers,
firstLayerDisp,
meshMod()
);
// Reset points according to extrusion model
forAll(layerExtrude.addedPoints(), pointI)
{
const labelList& pPoints = layerExtrude.addedPoints()[pointI];
forAll(pPoints, pPointI)
{
label meshPointI = pPoints[pPointI];
point modelPt
(
model()
(
extrudePatch.localPoints()[pointI],
extrudePatch.pointNormals()[pointI],
pPointI+1 // layer
)
);
const_cast<DynamicList<point>&>
(
meshMod().points()
)[meshPointI] = modelPt;
}
}
// Store faces on front and exposed patch (if mode=patch there are
// only added faces so cannot used map to old faces)
const labelListList& layerFaces = layerExtrude.layerFaces();
backPatchFaces.setSize(layerFaces.size());
frontPatchFaces.setSize(layerFaces.size());
forAll(backPatchFaces, i)
{
backPatchFaces[i] = layerFaces[i][0];
frontPatchFaces[i] = layerFaces[i][layerFaces[i].size()-1];
}
// Create dummy fvSchemes, fvSolution
createDummyFvMeshFiles(mesh, regionDir);
// Create actual mesh from polyTopoChange container
autoPtr<mapPolyMesh> map = meshMod().makeMesh
(
meshFromMesh,
IOobject
(
regionName,
runTimeExtruded.constant(),
runTimeExtruded,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh
);
// Calculate face labels for front and back.
frontPatchFaces = renumber
(
map().reverseFaceMap(),
frontPatchFaces
);
backPatchFaces = renumber
(
map().reverseFaceMap(),
backPatchFaces
);
}
else if (sourceType == "surface")
else
{
// Read from surface
fileName surfName(dict.lookup("surface"));
@ -126,52 +461,62 @@ int main(int argc, char *argv[])
Info<< "Extruding surfaceMesh read from file " << surfName << nl
<< endl;
IFstream is(surfName);
MeshedSurface<face> fMesh(surfName);
fMesh.reset(new faceMesh(is));
Info<< "Read patch from file " << surfName << nl
<< endl;
}
else
{
FatalErrorIn(args.executable())
<< "Illegal 'constructFrom' specification. Should either be "
<< "patch or surface." << exit(FatalError);
}
Switch flipNormals(dict.lookup("flipNormals"));
if (flipNormals)
{
Info<< "Flipping faces." << nl << endl;
faceList faces(fMesh().size());
forAll(faces, i)
if (flipNormals)
{
faces[i] = fMesh()[i].reverseFace();
Info<< "Flipping faces." << nl << endl;
faceList& faces = const_cast<faceList&>(fMesh.faces());
forAll(faces, i)
{
faces[i] = fMesh[i].reverseFace();
}
}
fMesh.reset(new faceMesh(faces, fMesh().localPoints()));
Info<< "Extruding surface with :" << nl
<< " points : " << fMesh.points().size() << nl
<< " faces : " << fMesh.size() << nl
<< " normals[0] : " << fMesh.faceNormals()[0]
<< nl
<< endl;
meshFromSurface.reset
(
new extrudedMesh
(
IOobject
(
extrudedMesh::defaultRegion,
runTimeExtruded.constant(),
runTimeExtruded
),
fMesh,
model()
)
);
// Get the faces on front and back
frontPatchName = "originalPatch";
frontPatchFaces = patchFaces
(
meshFromSurface().boundaryMesh(),
wordList(1, frontPatchName)
);
backPatchName = "otherSide";
backPatchFaces = patchFaces
(
meshFromSurface().boundaryMesh(),
wordList(1, backPatchName)
);
}
Info<< "Extruding patch with :" << nl
<< " points : " << fMesh().points().size() << nl
<< " faces : " << fMesh().size() << nl
<< " normals[0] : " << fMesh().faceNormals()[0]
<< nl
<< endl;
extrudedMesh mesh
polyMesh& mesh =
(
IOobject
(
extrudedMesh::defaultRegion,
runTimeExtruded.constant(),
runTimeExtruded
),
fMesh(),
model()
meshFromMesh.valid()
? meshFromMesh()
: meshFromSurface()
);
@ -184,17 +529,6 @@ int main(int argc, char *argv[])
<< "Merge distance : " << mergeDim << nl
<< endl;
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const label origPatchID = patches.findPatchID("originalPatch");
const label otherPatchID = patches.findPatchID("otherSide");
if (origPatchID == -1 || otherPatchID == -1)
{
FatalErrorIn(args.executable())
<< "Cannot find patch originalPatch or otherSide." << nl
<< "Valid patches are " << patches.names() << exit(FatalError);
}
// Collapse edges
// ~~~~~~~~~~~~~~
@ -237,6 +571,10 @@ int main(int argc, char *argv[])
// Update fields
mesh.updateMesh(map);
// Update stored data
updateFaceLabels(map(), frontPatchFaces);
updateFaceLabels(map(), backPatchFaces);
// Move mesh (if inflation used)
if (map().hasMotionPoints())
{
@ -252,22 +590,33 @@ int main(int argc, char *argv[])
Switch mergeFaces(dict.lookup("mergeFaces"));
if (mergeFaces)
{
if (mode == MESH)
{
FatalErrorIn(args.executable())
<< "Cannot stitch front and back of extrusion since"
<< " in 'mesh' mode (extrusion appended to mesh)."
<< exit(FatalError);
}
Info<< "Assuming full 360 degree axisymmetric case;"
<< " stitching faces on patches "
<< patches[origPatchID].name() << " and "
<< patches[otherPatchID].name() << " together ..." << nl << endl;
<< frontPatchName << " and "
<< backPatchName << " together ..." << nl << endl;
if (frontPatchFaces.size() != backPatchFaces.size())
{
FatalErrorIn(args.executable())
<< "Differing number of faces on front ("
<< frontPatchFaces.size() << ") and back ("
<< backPatchFaces.size() << ")"
<< exit(FatalError);
}
polyTopoChanger stitcher(mesh);
stitcher.setSize(1);
// Make list of masterPatch faces
labelList isf(patches[origPatchID].size());
forAll (isf, i)
{
isf[i] = patches[origPatchID].start() + i;
}
const word cutZoneName("originalCutFaceZone");
List<faceZone*> fz
@ -276,8 +625,8 @@ int main(int argc, char *argv[])
new faceZone
(
cutZoneName,
isf,
boolList(isf.size(), false),
frontPatchFaces,
boolList(frontPatchFaces.size(), false),
0,
mesh.faceZones()
)
@ -286,26 +635,58 @@ int main(int argc, char *argv[])
mesh.addZones(List<pointZone*>(0), fz, List<cellZone*>(0));
// Add the perfect interface mesh modifier
stitcher.set
perfectInterface perfectStitcher
(
"couple",
0,
new perfectInterface
(
"couple",
0,
stitcher,
cutZoneName,
patches[origPatchID].name(),
patches[otherPatchID].name()
)
stitcher,
cutZoneName,
word::null, // dummy patch name
word::null // dummy patch name
);
// Execute all polyMeshModifiers
autoPtr<mapPolyMesh> morphMap = stitcher.changeMesh(true);
// Topo change container
polyTopoChange meshMod(mesh);
mesh.movePoints(morphMap->preMotionPoints());
perfectStitcher.setRefinement
(
indirectPrimitivePatch
(
IndirectList<face>
(
mesh.faces(),
frontPatchFaces
),
mesh.points()
),
indirectPrimitivePatch
(
IndirectList<face>
(
mesh.faces(),
backPatchFaces
),
mesh.points()
),
meshMod
);
// Construct new mesh from polyTopoChange.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
// Update fields
mesh.updateMesh(map);
// Move mesh (if inflation used)
if (map().hasMotionPoints())
{
mesh.movePoints(map().preMotionPoints());
}
}
mesh.setInstance(runTimeExtruded.constant());
Info<< "Writing mesh to " << mesh.objectPath() << nl << endl;
if (!mesh.write())
{
FatalErrorIn(args.executable()) << "Failed writing mesh"

View File

@ -1,6 +1,7 @@
extrudeModel/extrudeModel.C
extrudeModel/newExtrudeModel.C
linearNormal/linearNormal.C
linearDirection/linearDirection.C
linearRadial/linearRadial.C
sigmaRadial/sigmaRadial.C
wedge/wedge.C

View File

@ -43,6 +43,7 @@ Foam::extrudeModel::extrudeModel
)
:
nLayers_(readLabel(dict.lookup("nLayers"))),
expansionRatio_(readScalar(dict.lookup("expansionRatio"))),
dict_(dict),
coeffDict_(dict.subDict(modelType + "Coeffs"))
{}
@ -62,5 +63,28 @@ Foam::label Foam::extrudeModel::nLayers() const
}
Foam::scalar Foam::extrudeModel::expansionRatio() const
{
return expansionRatio_;
}
Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
{
// 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
if (mag(1.0-expansionRatio_) < SMALL)
{
return scalar(layer)/nLayers_;
}
else
{
return
(1.0-pow(expansionRatio_, layer))
/ (1.0-pow(expansionRatio_, nLayers_));
}
}
// ************************************************************************* //

View File

@ -58,6 +58,8 @@ protected:
const label nLayers_;
const scalar expansionRatio_;
const dictionary& dict_;
const dictionary& coeffDict_;
@ -113,9 +115,15 @@ public:
label nLayers() const;
scalar expansionRatio() const;
// Member Operators
//- Helper: calculate cumulative relative thickness for layer.
// (layer=0 -> 0; layer=nLayers -> 1)
scalar sumThickness(const label layer) const;
virtual point operator()
(
const point& surfacePoint,

View File

@ -47,7 +47,7 @@ Foam::autoPtr<Foam::extrudeModel> Foam::extrudeModel::New
<< extrudeModelType
<< ", constructor not in hash table" << nl << nl
<< " Valid extrudeModel types are :" << nl
<< dictionaryConstructorTablePtr_->toc() << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}

View File

@ -22,71 +22,69 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "polyLineEdge.H"
#include "linearDirection.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(polyLineEdge, 0);
defineTypeNameAndDebug(linearDirection, 0);
// Add the curvedEdge constructor functions to the hash tables
curvedEdge::addIstreamConstructorToTable<polyLineEdge>
addPolyLineEdgeIstreamConstructorToTable_;
addToRunTimeSelectionTable(extrudeModel, linearDirection, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
polyLineEdge::polyLineEdge
(
const pointField& ps,
const label start,
const label end,
const pointField& otherpoints
)
linearDirection::linearDirection(const dictionary& dict)
:
curvedEdge(ps, start, end),
polyLine(knotlist(ps,start,end,otherpoints))
{}
// Construct from Istream
polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
:
curvedEdge(ps, is),
polyLine(knotlist(ps, start_, end_, pointField(is)))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector polyLineEdge::position(const scalar lambda) const
extrudeModel(typeName, dict),
direction_(coeffDict_.lookup("direction")),
thickness_(readScalar(coeffDict_.lookup("thickness")))
{
return polyLine::position(lambda);
direction_ /= mag(direction_);
if (thickness_ <= 0)
{
FatalErrorIn("linearDirection(const dictionary&)")
<< "thickness should be positive : " << thickness_
<< exit(FatalError);
}
}
//- Return the length of the curve
scalar polyLineEdge::length() const
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
linearDirection::~linearDirection()
{}
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
point linearDirection::operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const
{
return polyLine::lineLength_;
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*direction_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -23,74 +23,72 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::lineEdge
Foam::extrudeModels::linearDirection
Description
lineEdge class : defines a straight line between the start point and the
end point
SourceFiles
lineEdge.C
Extrudes by transforming points in a specified direction by a given distance
\*---------------------------------------------------------------------------*/
#ifndef lineEdge_H
#define lineEdge_H
#ifndef linearDirection_H
#define linearDirection_H
#include "curvedEdge.H"
#include "point.H"
#include "extrudeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace extrudeModels
{
/*---------------------------------------------------------------------------*\
Class lineEdge Declaration
Class linearDirection Declaration
\*---------------------------------------------------------------------------*/
class lineEdge
class linearDirection
:
public curvedEdge
public extrudeModel
{
// Private data
vector startPoint_;
//- Extrude direction
vector direction_;
//- layer thickness
scalar thickness_;
public:
//- Runtime type information
TypeName("line");
TypeName("linearDirection");
// Constructors
//- Construct from components
lineEdge(const pointField& points, const label start, const label end);
//- Construct from Istream setting pointsList
lineEdge(const pointField& points, Istream&);
//- Construct from dictionary
linearDirection(const dictionary& dict);
// Destructor
virtual ~lineEdge(){}
//- Destructor
~linearDirection();
// Member Functions
// Member Operators
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar) const;
//- Return the length of the curve
scalar length() const;
point operator()
(
const point& surfacePoint,
const vector& surfaceNormal,
const label layer
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace extrudeModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,3 +96,4 @@ public:
#endif
// ************************************************************************* //

View File

@ -72,7 +72,8 @@ point linearNormal::operator()
const label layer
) const
{
scalar d = thickness_*layer/nLayers_;
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*surfaceNormal;
}

View File

@ -64,7 +64,7 @@ public:
// Constructors
//- Construct from components
//- Construct from dictionary
linearNormal(const dictionary& dict);

View File

@ -67,8 +67,7 @@ point linearRadial::operator()
scalar rs = mag(surfacePoint);
vector rsHat = surfacePoint/rs;
scalar delta = (R_ - rs)/nLayers_;
scalar r = rs + layer*delta;
scalar r = rs + (R_ - rs)*sumThickness(layer);
return r*rsHat;
}

View File

@ -61,7 +61,7 @@ public:
// Constructors
//- Construct from components
//- Construct from dictionary
linearRadial(const dictionary& dict);

View File

@ -49,7 +49,13 @@ sigmaRadial::sigmaRadial(const dictionary& dict)
RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))),
pRef_(readScalar(coeffDict_.lookup("pRef"))),
pStrat_(readScalar(coeffDict_.lookup("pStrat")))
{}
{
if (mag(expansionRatio() - 1.0) > SMALL)
{
WarningIn("sigmaRadial::sigmaRadial(const dictionary&)")
<< "Ignoring expansionRatio setting." << endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -63,7 +63,7 @@ public:
// Constructors
//- Construct from components
//- Construct from dictionary
sigmaRadial(const dictionary& dict);

View File

@ -26,7 +26,7 @@ License
#include "wedge.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict)
axis_(coeffDict_.lookup("axis")),
angle_
(
readScalar(coeffDict_.lookup("angle"))
*mathematicalConstant::pi/180.0
degToRad(readScalar(coeffDict_.lookup("angle")))
)
{}
@ -88,8 +87,8 @@ point wedge::operator()
}
else
{
//sliceAngle = angle_*(layer + 1)/nLayers_;
sliceAngle = angle_*layer/nLayers_;
//sliceAngle = angle_*layer/nLayers_;
sliceAngle = angle_*sumThickness(layer);
}
// Find projection onto axis (or rather decompose surfacePoint

View File

@ -77,7 +77,7 @@ public:
// Constructors
//- Construct from components
//- Construct from dictionary
wedge(const dictionary& dict);

View File

@ -14,29 +14,36 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Where to get surface from: either from surface ('surface') or
// from (flipped) patch of existing case ('patch')
constructFrom patch; //surface;
// What to extrude:
// patch : from patch of another case ('sourceCase')
// mesh : as above but with original case included
// surface : from externally read surface
//constructFrom mesh;
constructFrom patch;
//constructFrom surface;
// If construct from patch/mesh:
sourceCase "../cavity";
sourcePatches (movingWall);
// If construct from patch: patch to use for back (can be same as sourcePatch)
exposedPatchName movingWall;
// If construct from surface:
surface "movingWall.stl";
// If construct from (flipped) patch
sourceCase "$FOAM_RUN/icoFoam/cavity";
sourcePatch movingWall;
// Flip surface normals before usage.
flipNormals false;
// If construct from surface
surface "movingWall.sMesh";
// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces true;
//- Linear extrusion in point-normal direction
//extrudeModel linearNormal;
//- Linear extrusion in specified direction
//extrudeModel linearDirection;
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
extrudeModel wedge;
@ -46,11 +53,13 @@ extrudeModel wedge;
//- Extrudes into sphere with grading according to pressure (atmospherics)
//extrudeModel sigmaRadial;
nLayers 20;
nLayers 10;
expansionRatio 1.0; //0.9;
wedgeCoeffs
{
axisPt (0 0.1 0);
axisPt (0 0.1 -0.05);
axis (-1 0 0);
angle 360; // For nLayers=1 assume symmetry so angle/2 on each side
}
@ -60,6 +69,12 @@ linearNormalCoeffs
thickness 0.05;
}
linearDirectionCoeffs
{
direction (0 1 0);
thickness 0.05;
}
linearRadialCoeffs
{
R 0.1;
@ -73,5 +88,10 @@ sigmaRadialCoeffs
}
// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces false; //true;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,114 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::faceMesh
Description
Storage for surface mesh i.e. points and faces.
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef faceMesh_H
#define faceMesh_H
#include "PrimitivePatch.H"
#include "faceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class faceMesh Declaration
\*---------------------------------------------------------------------------*/
class faceMesh
:
public PrimitivePatch<face, List, pointField>
{
// Private member functions
PrimitivePatch<face, List, pointField> read(Istream& is)
{
pointField points(is);
faceList faces(is);
return PrimitivePatch<face, Foam::List, pointField>(faces, points);
}
public:
// Constructors
//- Construct from components
faceMesh(const faceList& faces, const pointField& points)
:
PrimitivePatch<face, Foam::List, pointField>(faces, points)
{}
//- Construct from Istream
faceMesh(Istream& is)
:
PrimitivePatch<face, Foam::List, pointField>(read(is))
{}
// Member Functions
void flip()
{
forAll(*this, i)
{
face& f = operator[](i);
f = f.reverseFace();
}
clearOut();
}
// IOstream Operators
friend Ostream& operator<<(Ostream& os, const faceMesh& fm)
{
return os
<< fm.points()
<< token::NL
<< static_cast<PrimitivePatch<face, Foam::List, pointField> >
(fm);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
EXE_INC = \
/* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/autoMesh/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

@ -203,8 +203,8 @@ int main(int argc, char *argv[])
IOobject
(
"abc", // dummy name
//mesh.time().constant(), // instance
mesh.time().findInstance("triSurface", word::null),// instance
mesh.time().constant(), // instance
//mesh.time().findInstance("triSurface", word::null),// instance
"triSurface", // local
mesh.time(), // registry
IOobject::MUST_READ,
@ -363,6 +363,8 @@ int main(int argc, char *argv[])
if (wantRefine)
{
cpuTime timer;
autoRefineDriver refineDriver
(
meshRefiner,
@ -387,10 +389,15 @@ int main(int argc, char *argv[])
meshRefiner,
debug
);
Info<< "Mesh refined in = "
<< timer.cpuTimeIncrement() << " s." << endl;
}
if (wantSnap)
{
cpuTime timer;
autoSnapDriver snapDriver
(
meshRefiner,
@ -413,10 +420,15 @@ int main(int argc, char *argv[])
meshRefiner,
debug
);
Info<< "Mesh snapped in = "
<< timer.cpuTimeIncrement() << " s." << endl;
}
if (wantLayers)
{
cpuTime timer;
autoLayerDriver layerDriver(meshRefiner);
// Layer addition parameters
@ -442,6 +454,9 @@ int main(int argc, char *argv[])
meshRefiner,
debug
);
Info<< "Layers added in = "
<< timer.cpuTimeIncrement() << " s." << endl;
}

View File

@ -280,11 +280,14 @@ addLayersControls
nBufferCellsNoExtrude 0;
// Overall max number of layer addition iterations
// Overall max number of layer addition iterations. The mesher will exit
// if it reaches this number of iterations; possibly with an illegal
// mesh.
nLayerIter 50;
// Max number of iterations after which relaxed meshQuality controls
// get used.
// get used. Up to nRelaxIter it uses the settings in meshQualityControls,
// after nRelaxIter it uses the values in meshQualityControls::relaxed.
nRelaxedIter 20;
}

View File

@ -33,7 +33,7 @@ Description
#include "Time.H"
#include "boundaryMesh.H"
#include "repatchPolyTopoChanger.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "OFstream.H"
#include "ListOps.H"
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program:
int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{
r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset
(
new cellSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{
// currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old");
//backup(mesh, setName, currentSet, setName + "_old");
}
if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI)
{
// Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet);
autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear();

View File

@ -47,7 +47,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
timeSelector::addOptions(false); // no constant
timeSelector::addOptions();
# include "addRegionOption.H"
argList::validOptions.insert("noTopology", "");
argList::validOptions.insert("allGeometry", "");
@ -94,7 +94,8 @@ int main(int argc, char *argv[])
noFailedChecks += checkGeometry(mesh, allGeometry);
reduce(noFailedChecks, sumOp<label>());
// Note: no reduction in noFailedChecks necessary since is
// counter of checks, not counter of failed cells,faces etc.
if (noFailedChecks == 0)
{
@ -112,8 +113,6 @@ int main(int argc, char *argv[])
label nFailedChecks = checkGeometry(mesh, allGeometry);
reduce(nFailedChecks, sumOp<label>());
if (nFailedChecks)
{
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"

View File

@ -6,4 +6,5 @@ EXE_INC = \
EXE_LIBS = \
-ldynamicMesh \
-lmeshTools \
-lfiniteVolume
-lfiniteVolume \
-lgenericPatchFields

View File

@ -125,6 +125,7 @@ label findPatchID(const polyMesh& mesh, const word& name)
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
argList::validArgs.append("faceZone");
argList::validArgs.append("patch");
argList::validOptions.insert("additionalPatches", "(patch2 .. patchN)");
@ -134,7 +135,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
# include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -146,6 +147,14 @@ int main(int argc, char *argv[])
Info<< "Converting faces on zone " << zoneID.name()
<< " into baffles." << nl << endl;
if (zoneID.index() == -1)
{
FatalErrorIn(args.executable()) << "Cannot find faceZone "
<< zoneID.name() << endl
<< "Valid zones are " << faceZones.names()
<< exit(FatalError);
}
const faceZone& fZone = faceZones[zoneID.index()];
Info<< "Found " << returnReduce(fZone.size(), sumOp<label>())

View File

@ -208,8 +208,8 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
// Dump halves
{
OFstream str(prefix+cycPatch.name()+"_half0.obj");
Pout<< "Dumping cycPatch.name() half0 faces to " << str.name()
<< endl;
Pout<< "Dumping " << cycPatch.name()
<< " half0 faces to " << str.name() << endl;
meshTools::writeOBJ
(
str,
@ -226,8 +226,8 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
}
{
OFstream str(prefix+cycPatch.name()+"_half1.obj");
Pout<< "Dumping cycPatch.name() half1 faces to " << str.name()
<< endl;
Pout<< "Dumping " << cycPatch.name()
<< " half1 faces to " << str.name() << endl;
meshTools::writeOBJ
(
str,
@ -516,11 +516,13 @@ void syncPoints
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
argList::validOptions.insert("overwrite", "");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createNamedPolyMesh.H"
const bool overwrite = args.optionFound("overwrite");
@ -532,6 +534,11 @@ int main(int argc, char *argv[])
(
"createPatchDict",
runTime.system(),
(
regionName != polyMesh::defaultRegion
? regionName
: word::null
),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
@ -551,7 +558,6 @@ int main(int argc, char *argv[])
coupledPolyPatch::matchTol = tol;
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -563,7 +569,7 @@ int main(int argc, char *argv[])
dumpCyclicMatch("initial_", mesh);
// Read patch construct info from dictionary
PtrList<dictionary> patchSources(dict.lookup("patches"));
PtrList<dictionary> patchSources(dict.lookup("patchInfo"));

View File

@ -46,25 +46,25 @@ matchTolerance 1E-3;
pointSync true;
// Patches to create.
patches
patchInfo
(
{
// Name of new patch
name sidePatches;
// Type of new patch
dictionary
{
dictionary
{
type cyclic;
// Optional: explicitly set transformation tensor.
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
//transform translational;
//separationVector (-2289 0 0);
transform rotational;
rotationAxis (1 0 0);
transform rotational;
rotationAxis (1 0 0);
rotationCentre (0 0 0);
}
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
@ -80,10 +80,10 @@ patches
name bottom;
// Type of new patch
dictionary
{
dictionary
{
type wall;
}
}
constructFrom set;

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program:
int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{
r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset
(
new faceSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{
// currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old");
//backup(mesh, setName, currentSet, setName + "_old");
}
if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI)
{
// Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet);
autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear();

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
(
IOobject
(
mergePolyMesh::defaultRegion,
masterRegion,
runTimeMaster.timeName(),
runTimeMaster
)
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
(
IOobject
(
mergePolyMesh::defaultRegion,
addRegion,
runTimeToAdd.timeName(),
runTimeToAdd
)

View File

@ -2,9 +2,11 @@
argList::validArgs.append("master root");
argList::validArgs.append("master case");
argList::validOptions.insert("masterRegion", "name");
argList::validArgs.append("root to add");
argList::validArgs.append("case to add");
argList::validOptions.insert("addRegion", "name");
argList args(argc, argv);
@ -15,9 +17,15 @@
fileName rootDirMaster(args.additionalArgs()[0]);
fileName caseDirMaster(args.additionalArgs()[1]);
word masterRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("masterRegion", masterRegion);
fileName rootDirToAdd(args.additionalArgs()[2]);
fileName caseDirToAdd(args.additionalArgs()[3]);
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
Info<< "Master: " << rootDirMaster << " " << caseDirMaster << nl
<< "mesh to add: " << rootDirToAdd << " " << caseDirToAdd << endl;
Info<< "Master: " << rootDirMaster << " " << caseDirMaster
<< " region " << masterRegion << nl
<< "mesh to add: " << rootDirToAdd << " " << caseDirToAdd
<< " region " << addRegion << endl;

View File

@ -5,5 +5,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools \
-ldynamicMesh

View File

@ -222,13 +222,14 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
argList::validOptions.insert("split", "");
argList::validOptions.insert("overwrite", "");
argList::validOptions.insert("detectOnly", "");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
# include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
bool split = args.optionFound("split");

View File

@ -167,6 +167,16 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
forAll (oldPatches, patchI)
{
const polyPatch& curPatch = oldPatches[patchI];
if (curPatch.coupled())
{
WarningIn("mirrorFvMesh::mirrorFvMesh(const IOobject&)")
<< "Found coupled patch " << curPatch.name() << endl
<< " Mirroring faces on coupled patches destroys"
<< " the ordering. This might be fixed by running a dummy"
<< " createPatch afterwards." << endl;
}
boolList& curInsBouFace = insertedBouFace[patchI];
curInsBouFace.setSize(curPatch.size());

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program:
int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{
r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset
(
new pointSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{
// currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old");
//backup(mesh, setName, currentSet, setName + "_old");
}
if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI)
{
// Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet);
autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear();

View File

@ -268,10 +268,7 @@ label twoDNess(const polyMesh& mesh)
{
const polyPatch& patch = patches[patchI];
if
(
typeid(patch) != typeid(wedgePolyPatch)
)
if (!isA<wedgePolyPatch>(patch))
{
const vectorField& n = patch.faceAreas();

View File

@ -8,4 +8,5 @@ EXE_LIBS = \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume \
-lgenericPatchFields \
-ldecompositionMethods

Some files were not shown because too many files have changed in this diff Show More