Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
6680ddcf
Commit
6680ddcf
authored
Mar 22, 2010
by
mattijs
Browse files
ENH: Reuse existing zones.
parent
f5322b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
View file @
6680ddcf
...
...
@@ -68,6 +68,104 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
label
addPointZone
(
const
polyMesh
&
mesh
,
const
word
&
name
)
{
label
zoneID
=
mesh
.
pointZones
().
findZoneID
(
name
);
if
(
zoneID
!=
-
1
)
{
Info
<<
"Reusing existing pointZone "
<<
mesh
.
pointZones
()[
zoneID
].
name
()
<<
" at index "
<<
zoneID
<<
endl
;
}
else
{
pointZoneMesh
&
pointZones
=
const_cast
<
polyMesh
&>
(
mesh
).
pointZones
();
zoneID
=
pointZones
.
size
();
Info
<<
"Adding pointZone "
<<
name
<<
" at index "
<<
zoneID
<<
endl
;
pointZones
.
setSize
(
zoneID
+
1
);
pointZones
.
set
(
zoneID
,
new
pointZone
(
name
,
labelList
(
0
),
zoneID
,
pointZones
)
);
}
return
zoneID
;
}
label
addFaceZone
(
const
polyMesh
&
mesh
,
const
word
&
name
)
{
label
zoneID
=
mesh
.
faceZones
().
findZoneID
(
name
);
if
(
zoneID
!=
-
1
)
{
Info
<<
"Reusing existing faceZone "
<<
mesh
.
faceZones
()[
zoneID
].
name
()
<<
" at index "
<<
zoneID
<<
endl
;
}
else
{
faceZoneMesh
&
faceZones
=
const_cast
<
polyMesh
&>
(
mesh
).
faceZones
();
zoneID
=
faceZones
.
size
();
Info
<<
"Adding faceZone "
<<
name
<<
" at index "
<<
zoneID
<<
endl
;
faceZones
.
setSize
(
zoneID
+
1
);
faceZones
.
set
(
zoneID
,
new
faceZone
(
name
,
labelList
(
0
),
boolList
(),
zoneID
,
faceZones
)
);
}
return
zoneID
;
}
label
addCellZone
(
const
polyMesh
&
mesh
,
const
word
&
name
)
{
label
zoneID
=
mesh
.
cellZones
().
findZoneID
(
name
);
if
(
zoneID
!=
-
1
)
{
Info
<<
"Reusing existing cellZone "
<<
mesh
.
cellZones
()[
zoneID
].
name
()
<<
" at index "
<<
zoneID
<<
endl
;
}
else
{
cellZoneMesh
&
cellZones
=
const_cast
<
polyMesh
&>
(
mesh
).
cellZones
();
zoneID
=
cellZones
.
size
();
Info
<<
"Adding cellZone "
<<
name
<<
" at index "
<<
zoneID
<<
endl
;
cellZones
.
setSize
(
zoneID
+
1
);
cellZones
.
set
(
zoneID
,
new
cellZone
(
name
,
labelList
(
0
),
zoneID
,
cellZones
)
);
}
return
zoneID
;
}
// Checks whether patch present
void
checkPatch
(
const
polyBoundaryMesh
&
bMesh
,
const
word
&
name
)
{
...
...
@@ -211,30 +309,21 @@ int main(int argc, char *argv[])
polyTopoChanger
stitcher
(
mesh
);
stitcher
.
setSize
(
1
);
DynamicList
<
pointZone
*>
pz
;
DynamicList
<
faceZone
*>
fz
;
DynamicList
<
cellZone
*>
cz
;
mesh
.
pointZones
().
clearAddressing
()
;
mesh
.
faceZones
().
clearAddressing
()
;
mesh
.
cellZones
().
clearAddressing
()
;
if
(
perfectCover
)
{
// Add empty zone for resulting internal faces
fz
.
append
label
cutZoneID
=
addFaceZone
(
mesh
,
cutZoneName
);
mesh
.
faceZones
()[
cutZoneID
].
resetAddressing
(
new
faceZone
(
cutZoneName
,
isf
,
boolList
(
masterPatch
.
size
(),
false
),
0
,
mesh
.
faceZones
()
)
isf
,
boolList
(
masterPatch
.
size
(),
false
)
);
// Note: make sure to add the zones BEFORE constructing polyMeshModifier
// (since looks up various zones at construction time)
Info
<<
"Adding point and face zones"
<<
endl
;
mesh
.
addZones
(
pz
.
shrink
(),
fz
.
shrink
(),
cz
.
shrink
());
// Add the perfect interface mesh modifier
stitcher
.
set
(
...
...
@@ -252,27 +341,15 @@ int main(int argc, char *argv[])
}
else
{
pz
.
append
(
new
pointZone
(
mergePatchName
+
"CutPointZone"
,
labelList
(
0
),
0
,
mesh
.
pointZones
()
)
);
label
pointZoneID
=
addPointZone
(
mesh
,
mergePatchName
+
"CutPointZone"
);
mesh
.
pointZones
()[
pointZoneID
]
=
labelList
(
0
);
label
masterZoneID
=
addFaceZone
(
mesh
,
mergePatchName
+
"MasterZone"
);
fz
.
append
mesh
.
faceZones
()[
masterZoneID
].
resetAddressing
(
new
faceZone
(
mergePatchName
+
"MasterZone"
,
isf
,
boolList
(
masterPatch
.
size
(),
false
),
0
,
mesh
.
faceZones
()
)
isf
,
boolList
(
masterPatch
.
size
(),
false
)
);
// Slave patch
...
...
@@ -284,42 +361,27 @@ int main(int argc, char *argv[])
labelList
osf
(
slavePatch
.
size
());
forAll
(
osf
,
i
)
forAll
(
osf
,
i
)
{
osf
[
i
]
=
slavePatch
.
start
()
+
i
;
}
fz
.
append
label
slaveZoneID
=
addFaceZone
(
mesh
,
mergePatchName
+
"SlaveZone"
);
mesh
.
faceZones
()[
slaveZoneID
].
resetAddressing
(
new
faceZone
(
mergePatchName
+
"SlaveZone"
,
osf
,
boolList
(
slavePatch
.
size
(),
false
),
1
,
mesh
.
faceZones
()
)
osf
,
boolList
(
slavePatch
.
size
(),
false
)
);
// Add empty zone for cut faces
fz
.
append
label
cutZoneID
=
addFaceZone
(
mesh
,
cutZoneName
);
mesh
.
faceZones
()[
cutZoneID
].
resetAddressing
(
new
faceZone
(
cutZoneName
,
labelList
(
0
),
boolList
(
0
,
false
),
2
,
mesh
.
faceZones
()
)
labelList
(
0
),
boolList
(
0
,
false
)
);
// Note: make sure to add the zones BEFORE constructing polyMeshModifier
// (since looks up various zones at construction time)
Info
<<
"Adding point and face zones"
<<
endl
;
mesh
.
addZones
(
pz
.
shrink
(),
fz
.
shrink
(),
cz
.
shrink
());
// Add the sliding interface mesh modifier
stitcher
.
set
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment