Commit 83bf5a7f authored by henry's avatar henry
Browse files
parents 44c01439 4b90cc4c
This diff is collapsed.
213 3 0 0
1 0 0 0
2 2 0 0
3 2 1 0
4 0 1 0
5 0 0 1
6 2 0 1
7 2 1 1
8 0 1 1
9 1.0000469999999999 0 0
10 0.999668 1 0
11 0.99944500000000003 1 1
12 1.000594 0 1
13 2 0 0.50021530000000003
14 2 0.50012599999999996 0
15 0 1 0.50045629999999997
16 0 0.49964989999999998 0
17 0.62483357601847556 1 0.49991643678795222
18 0 0 0.5
19 0 0.5 1
20 0.62494657145582122 0.49985790875808178 0
21 1.375120204581187 0 0.4997949845615941
22 2 0.5 1
23 2 1 0.5
24 0.499834 1 0
25 0.50029699999999999 0 1
26 0.49972250000000001 1 1
27 0 0.50000006130646835 0.49999993869353165
28 0.50002349999999995 0 0
29 1.5000235 0 0
30 1.1458145624989733 0.5000553177266871 0
31 1.3748336567109987 1 0.5000836868059465
32 0.75044549999999999 0.49971323947400004 1
33 0.75044549999999999 0 0.50013668162500002
34 1.500297 0 1
35 2 0.49999999206099965 0.49999999206099965
36 1.4997225000000001 1 1
37 0.88530655619767451 0.69523571541331353 0
38 0.74975100000000006 1 0
39 0.99985800700011418 1 0.39062501526316751
40 0 0.2500000613064608 0.7499999386935392
41 0.2501485 0 1
42 0.37527044007359472 0.62466041202689604 1
43 0 0.7497720581817594 0.74999999997204392
44 0.24986125000000001 1 1
45 0.31241083060970776 0.68739558038665782 0
46 0 1 0.25022814999999998
47 0 0.74982495000000005 0
48 0.3125356465289606 0.31239559711921033 0
49 0.37524548555134551 0 0.37523962153691648
50 0 0.25000000002145584 0.25017492745143088
51 1.2500352499999998 0 0
52 1.0626973305232652 0 0.34361890927552119
53 1.4998339999999999 1 0
54 0.74958374999999999 1 1
55 0.88519156134454835 1 0.69523493182271912
56 0.75044549999999999 0 1
57 0.75003524999999993 0 0
58 0.88545457775712011 0.3046775110714553 0
59 1.4999999173907641 0.49999999435116604 1
60 2 0.25010760364761792 0.74999999999829137
61 2 0.25 1
62 2 0 0.75010765000000001
63 1.5729133203896351 0.4271084905205621 0
64 2 0 0.25010765000000001
65 2 0.25006299999999998 0
66 0.81619988117037301 0.51616065956439328 0.48387527405505287
67 0.62479250000000008 1 0.23434098330631092
68 0.62479250000000008 0.7655391212272894 0
69 1.2497509999999998 1 0
70 0 0.25 1
71 0 0 0.75
72 0.37522274999999999 0.29980854989635936 1
73 0.37522274999999999 0 0.70013946473134281
74 0 0.49988605975809192 0.74988593714516283
75 0.31255174452459605 1 0.65638401293888804
76 0 0.75 1
77 0.249917 1 0
78 0 0.70831779089254521 0.29167340665919461
79 0.25001174999999998 0 0
80 0.62526649037406934 0 0.25017085386153537
81 0.625029375 0.23429805042184107 0
82 0 0.24982494999999999 0
83 0 0.25008755567468249 0.50008743306175329
84 0.33552291795286748 0.37713361953826796 0.37295234921245662
85 1.3275022682494733 0.27703395451399626 0
86 1.6873917295541676 1 0.31254602883562033
87 1.7393002110516891 0.73944000928409781 0
88 2 0.7499999999989998 0.25006298412499983
89 0.62528740222670842 0.74964177558619371 1
90 0.62465312500000003 1 0.76556323888302447
91 0.87551975000000004 0.24985661973700002 1
92 0.87551975000000004 0 0.75006834081249996
93 1.1922864636768418 1 0.75390684273024755
94 1.24958375 0.74986113453803516 1
95 1.1698804466514103 0.41956399899988917 1
96 1.187959730551635 0 0.74997433471920583
97 1.6874419282782818 1 0.68754603555472626
98 1.7498612499999999 1 1
99 2 0.74999999206099988 0.74999999206099988
100 1.6597700161872737 0 0.69432640578660343
101 1.6597808229817657 0 0.30542952755181008
102 1.7499999601075902 0.375 1
103 1.3990667318832528 0.69603906683685635 0
104 1.4950021306707608 0.49065317884606224 0.49500212996719484
105 2 0.37509449999999989 0.24996850198475024
106 0.82837583873678577 0.49993500845038119 0
107 1.0695558475797649 0.66971322958604163 0.29687786818700823
108 0.85307867962811157 0.24362257622712302 0.31516017245746403
109 0.82827226523186892 1 0.49992109713449329
110 0.85617934854666022 1 0.20723770847200895
111 0.52956259724790877 0.46221182650782827 0.70815142735106607
112 0.197844687328108 0.19781366296788089 1
113 0.19785716305721113 0 0.8021738538924329
114 0.2208783106844166 0.46225714309073845 1
115 0 1 0.75022814999999998
116 0.43264896150206789 1 0.81375076634557386
117 0.374791875 0.83312128766119486 1
118 0 0.72915434172921567 0.52082680685839422
119 0.25758862433333551 1 0.37534222499999997
120 0 0 0.25
121 0.22089000562634489 0 0.53767874257955828
122 0.21890193241166289 0 0.21890047052636122
123 0 0.48262354769989868 0.23265983080935737
124 0.52955330709238257 0 0.53770034194467331
125 0.49219718763882514 0.367036574432759 0
126 0.5505556528350013 0.63265541955504201 0.30493806376468496
127 1.4081582558189005 0 0.24254676799800692
128 1.1015512434437607 0.21206527974784434 0
129 1.7499169999999999 1 0
130 2 0.75006299999999992 0
131 2 1 0.25
132 0.99401036538229792 0.63676792199224752 1
133 0.75067050430146165 0.71769786903092825 0.71464771158468776
134 1.24958375 1 1
135 1.2504455000000001 0 1
136 1.3860715978416591 0.24993221667186555 1
137 1.0317202752404047 0.31469238410894046 0.6853270709080328
138 1.4426349216014702 1 0.74140038799848562
139 1.6247918750000001 0.75006931305374525 1
140 2 1 0.75
141 2 0.74996849602949978 0.50003148809249964
142 2 0.24999994966813449 0.49999998078418173
143 1.7500117500000001 0 0
144 1.7501484999999999 0 1
145 2 0.5000537978534545 0.74994618626854503
146 1.3747924999999996 1 0.23440908488585499
147 1.5571177737167572 0.81232629338982021 0
148 1.5545253193695066 1 0.17972930755262501
149 1.3104200347998118 0.56041577372755713 0.74814782862252316
150 1.3685266838244452 0.48564116582667954 0.21802764397288932
151 1.5873602781685263 0.78126669962189421 0.50005942609143139
152 1.5838618227448735 0.20899413185535243 0.49987585715718413
153 1.7498120256325995 0.25018792583716926 0
154 1.8148371462917434 0 0.18519382949207305
155 2 0.18752406345187056 0.18753523208397008
156 1.7770110643184227 0.51886547556217666 0
157 1.1389013076817112 0.76226887437066193 0
158 1.1602175406966813 1 0.53828850106094039
159 0.90095306490776128 0.48470516503498373 0.2446998657917499
160 0.57742475390278236 0.27551969863450299 0.27345305390889807
161 0.81036655925196366 0.7630643710333207 0.35054165377955776
162 0.52956259724790877 0.46221182650782827 1
163 0.29250079461431827 0.2842960350422109 0.71570127112180726
164 0.27385619515889037 0.6248453002643185 0.71436194557321087
165 0.62168045737651678 0 0.77560610491729931
166 0.62537124999999993 0.2188435803315899 1
167 0.40196038774740384 1 0.20267603513549107
168 0.17704223351222992 0.82288246470050785 0
169 0.18892018646284411 1 0.18899622733072144
170 0.23373058746113159 0.23679172957531613 0.21078402860060638
171 0.24428427259573549 0.59937304517793366 0.24724219230200442
172 0.42388190576270124 1 0.4887158204143946
173 1.0208555875954755 1 0.81817459887813815
174 1.0669175695053206 0.81733378836053194 1
175 0.8464712840664248 0.80134170756139955 1
176 0.60552202714220704 0.62419153018194229 0.54239960836207701
177 1.606777848712118 0.19973253606683206 1
178 1.4250560553222698 0 0.732249791887851
179 1.12551975 0.19352873225326209 1
180 1.1620342234529084 0 0.53548179044497457
181 0.77419059143108437 0.35536625456813642 0.76865650139332142
182 0.95600842566592681 0 0.52050427577014857
183 2 0.75 1
184 1.8229055680968635 1 0.82294606919028224
185 1.8124074661770861 0.8124421408239394 1
186 1.6847465495324894 0.55699324455967203 0.74450659675858755
187 1.1945125727535346 0.47020737648361044 0.48501348343009743
188 1.4371531545555845 0.81243056656291324 1
189 1.0230031981183827 0.60745624022002409 0.70905352953001077
190 1.3178218537541635 0.74283221838842173 0.24644567916733129
191 1.2298563370114035 0.23209604059822986 0.27403980288191482
192 1.7289412043422971 0.73378563235104455 0.27218740896208421
193 1.6944192651948711 0.39497422853539144 0.28096087015676863
194 1.719021973042385 0.27206088666699435 0.73925099693622187
195 0.51628118103442489 0.26487001488387318 0.53136856951372224
196 0.22693818747394334 0.22584860839480125 0.50499300132112901
197 0.18870598201308805 1 0.81131589108741564
198 0.18140974929389231 0.81855222162009078 1
199 0.52377345173705003 0.22575111801259504 0.77599180569982884
200 0.44512574719134834 0.82031319413422632 0
201 0.43769402753141229 0 0.18763960779463965
202 0.23194582827732274 0.56348972010969589 0.48517047319960538
203 1.404605953982319 0.2885118284317002 0.71332319773860509
204 0.83285106746651061 0.22679389369216291 0.56316489552371896
205 1.746191712341544 0.57096666984982924 0.48834249131610469
206 1.2698479063322867 0.73902081556323673 0.53223169180184582
207 1.0027339377070847 0.7783240018776667 0.51915438810718473
208 1.1247094999999998 1 0.19525173141898322
209 1.0585177272595161 0.22306568484158776 0.45497453797743681
210 1.5766743500280587 0.62019545180903912 0
211 1.5362846212581589 0.2135856104587727 0
212 1.7956396187713533 0.19223457391785517 0.37621602432494938
213 0.2338562054207384 0.80644498148268706 0.52587899633894741
# Generated by tetgen -qfa0.005 beam.poly
......@@ -154,10 +154,77 @@ void insertDuplicateMerge
}
labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
{
// Get all duplicate face labels (in boundaryFaces indices!).
labelList duplicates = localPointRegion::findDuplicateFaces
(
mesh,
boundaryFaces
);
// Check that none are on processor patches
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(duplicates, bFaceI)
{
if (duplicates[bFaceI] != -1)
{
label faceI = mesh.nInternalFaces() + bFaceI;
label patchI = patches.whichPatch(faceI);
if (isA<processorPolyPatch>(patches[patchI]))
{
FatalErrorIn("findBaffles(const polyMesh&, const labelList&)")
<< "Duplicate face " << faceI
<< " is on a processorPolyPatch."
<< "This is not allowed." << nl
<< "Face:" << faceI
<< " is on patch:" << patches[patchI].name()
<< abort(FatalError);
}
}
}
// Write to faceSet for ease of postprocessing.
{
faceSet duplicateSet
(
mesh,
"duplicateFaces",
(mesh.nFaces() - mesh.nInternalFaces())/256
);
forAll(duplicates, bFaceI)
{
label otherFaceI = duplicates[bFaceI];
if (otherFaceI != -1 && otherFaceI > bFaceI)
{
duplicateSet.insert(mesh.nInternalFaces() + bFaceI);
duplicateSet.insert(mesh.nInternalFaces() + otherFaceI);
}
}
Pout<< "Writing " << duplicateSet.size()
<< " duplicate faces to faceSet " << duplicateSet.objectPath()
<< nl << endl;
duplicateSet.write();
}
return duplicates;
}
int main(int argc, char *argv[])
{
argList::validOptions.insert("split", "");
argList::validOptions.insert("overwrite", "");
argList::validOptions.insert("detectOnly", "");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
......@@ -165,6 +232,7 @@ int main(int argc, char *argv[])
bool split = args.options().found("split");
bool overwrite = args.options().found("overwrite");
bool detectOnly = args.options().found("detectOnly");
// Collect all boundary faces
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());
......@@ -175,6 +243,15 @@ int main(int argc, char *argv[])
}
if (detectOnly)
{
findBaffles(mesh, boundaryFaces);
return 0;
}
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
......@@ -238,62 +315,7 @@ int main(int argc, char *argv[])
<< nl << endl;
// Get all duplicate face labels (in boundaryFaces indices!).
labelList duplicates = localPointRegion::findDuplicateFaces
(
mesh,
boundaryFaces
);
// Check that none are on processor patches
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(duplicates, bFaceI)
{
if (duplicates[bFaceI] != -1)
{
label faceI = mesh.nInternalFaces() + bFaceI;
label patchI = patches.whichPatch(faceI);
if (isA<processorPolyPatch>(patches[patchI]))
{
FatalErrorIn(args.executable())
<< "Duplicate face " << faceI
<< " is on a processorPolyPatch."
<< "This is not allowed." << nl
<< "Face:" << faceI
<< " is on patch:" << patches[patchI].name()
<< abort(FatalError);
}
}
}
// Write to faceSet for ease of postprocessing.
{
faceSet duplicateSet
(
mesh,
"duplicateFaces",
(mesh.nFaces() - mesh.nInternalFaces())/256
);
forAll(duplicates, bFaceI)
{
label otherFaceI = duplicates[bFaceI];
if (otherFaceI != -1 && otherFaceI > bFaceI)
{
duplicateSet.insert(mesh.nInternalFaces() + bFaceI);
duplicateSet.insert(mesh.nInternalFaces() + otherFaceI);
}
}
Pout<< "Writing " << duplicateSet.size()
<< " duplicate faces to faceSet " << duplicateSet.objectPath()
<< nl << endl;
duplicateSet.write();
}
labelList duplicates(findBaffles(mesh, boundaryFaces));
// Merge into internal faces.
insertDuplicateMerge(mesh, duplicates, meshMod);
......
......@@ -714,9 +714,11 @@ commandStatus parseAction(const word& actionName)
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
# include "addTimeOptions.H"
argList::validOptions.insert("noVTK", "");
argList::validOptions.insert("batch", "file");
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
......@@ -730,7 +732,7 @@ int main(int argc, char *argv[])
runTime.setTime(Times[startTime], startTime);
# include "createPolyMesh.H"
# include "createNamedPolyMesh.H"
// Print some mesh info
printMesh(runTime, mesh);
......
......@@ -284,12 +284,28 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
label oldSize = pointZones_.size();
if (newPointZones.size() <= pointZones_.size())
{
pointZones_.setSize(newPointZones.size());
}
// Reset existing ones
forAll (pointZones_, czI)
{
pointZones_[czI] = newPointZones[czI];
}
// Extend with extra ones
pointZones_.setSize(newPointZones.size());
forAll (pointZones_, pzI)
for (label czI = oldSize; czI < newPointZones.size(); czI++)
{
pointZones_[pzI] = newPointZones[pzI];
pointZones_.set(czI, newPointZones[czI].clone(pointZones_));
}
faceZoneMesh newFaceZones
(
IOobject
......@@ -305,7 +321,14 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
faceZones_.setSize(newFaceZones.size());
oldSize = faceZones_.size();
if (newFaceZones.size() <= faceZones_.size())
{
faceZones_.setSize(newFaceZones.size());
}
// Reset existing ones
forAll (faceZones_, fzI)
{
faceZones_[fzI].resetAddressing
......@@ -315,6 +338,15 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
);
}
// Extend with extra ones
faceZones_.setSize(newFaceZones.size());
for (label fzI = oldSize; fzI < newFaceZones.size(); fzI++)
{
faceZones_.set(fzI, newFaceZones[fzI].clone(faceZones_));
}
cellZoneMesh newCellZones
(
IOobject
......@@ -330,12 +362,28 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
cellZones_.setSize(newCellZones.size());
oldSize = cellZones_.size();
if (newCellZones.size() <= cellZones_.size())
{
cellZones_.setSize(newCellZones.size());
}
// Reset existing ones
forAll (cellZones_, czI)
{
cellZones_[czI] = newCellZones[czI];
}
// Extend with extra ones
cellZones_.setSize(newCellZones.size());
for (label czI = oldSize; czI < newCellZones.size(); czI++)
{
cellZones_.set(czI, newCellZones[czI].clone(cellZones_));
}
if (boundaryChanged)
{
return polyMesh::TOPO_PATCH_CHANGE;
......
......@@ -218,7 +218,8 @@ Foam::label Foam::autoSnapDriver::getCollocatedPoints
// Calculate displacement as average of patch points.
Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
(
const motionSmoother& meshMover
const motionSmoother& meshMover,
const List<labelPair>& baffles
) const
{
const indirectPrimitivePatch& pp = meshMover.patch();
......@@ -253,6 +254,34 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
const pointField& points = pp.points();
const polyMesh& mesh = meshMover.mesh();
// Get labels of faces to count (master of coupled faces and baffle pairs)
PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh));
{
forAll(baffles, i)
{
label f0 = baffles[i].first();
label f1 = baffles[i].second();
if (isMasterFace.get(f0) == 1)
{
// Make f1 a slave
isMasterFace.set(f1, 0);
}
else if (isMasterFace.get(f1) == 1)
{
isMasterFace.set(f0, 0);
}
else
{
FatalErrorIn("autoSnapDriver::smoothPatchDisplacement(..)")
<< "Both sides of baffle consisting of faces " << f0
<< " and " << f1 << " are already slave faces."
<< abort(FatalError);
}
}
}
// Get average position of boundary face centres
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -266,9 +295,14 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
forAll(pFaces, pfI)
{
avgBoundary[patchPointI] += pp[pFaces[pfI]].centre(points);
label faceI = pFaces[pfI];
if (isMasterFace.get(pp.addressing()[faceI]) == 1)
{
avgBoundary[patchPointI] += pp[faceI].centre(points);
nBoundary[patchPointI]++;
}
}
nBoundary[patchPointI] = pFaces.size();
}
syncTools::syncPointList
......@@ -886,7 +920,7 @@ void Foam::autoSnapDriver::preSmoothPatch
checkFaces[faceI] = faceI;
}
pointField patchDisp(smoothPatchDisplacement(meshMover));
pointField patchDisp(smoothPatchDisplacement(meshMover, baffles));
// The current mesh is the starting mesh to smooth from.
meshMover.setDisplacement(patchDisp);
......@@ -1008,9 +1042,11 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
// Displacement per patch point
vectorField patchDisp(localPoints.size(), vector::zero);
if (returnReduce(localPoints.size(), sumOp<label>()) > 0)
{
// Current surface snapped to
labelList snapSurf(localPoints.size(), -1);
// Divide surfaces into zoned and unzoned
labelList zonedSurfaces;
labelList unzonedSurfaces;
......@@ -1039,16 +1075,9 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
patchDisp[pointI] =
hitInfo[pointI].hitPoint()
- localPoints[pointI];
snapSurf[pointI] = hitSurface[pointI];
}
//else
//{
// WarningIn("autoSnapDriver::calcNearestSurface(..)")
// << "For point:" << pointI
// << " coordinate:" << localPoints[pointI]
// << " did not find any surface within:"
// << 4*snapDist[pointI]
// << " meter." << endl;
//}
}
}
......@@ -1060,6 +1089,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
// Surfaces with zone information
const wordList& faceZoneNames = surfaces.faceZoneNames();
// Current best snap distance
scalarField minSnapDist(snapDist);