Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
f1aa8b5f
Commit
f1aa8b5f
authored
13 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
ENH: topoSet: add remove support
parent
26aa427d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
applications/utilities/mesh/manipulation/topoSet/topoSet.C
+100
-0
100 additions, 0 deletions
applications/utilities/mesh/manipulation/topoSet/topoSet.C
applications/utilities/mesh/manipulation/topoSet/topoSetDict
+9
-1
9 additions, 1 deletion
applications/utilities/mesh/manipulation/topoSet/topoSetDict
with
109 additions
and
1 deletion
applications/utilities/mesh/manipulation/topoSet/topoSet.C
+
100
−
0
View file @
f1aa8b5f
...
...
@@ -35,6 +35,10 @@ Description
#include
"pointSet.H"
#include
"globalMeshData.H"
#include
"timeSelector.H"
#include
"IOobjectList.H"
#include
"cellZoneSet.H"
#include
"faceZoneSet.H"
#include
"pointZoneSet.H"
using
namespace
Foam
;
...
...
@@ -51,6 +55,96 @@ void printMesh(const Time& runTime, const polyMesh& mesh)
}
template
<
class
ZoneType
>
void
removeZone
(
ZoneMesh
<
ZoneType
,
polyMesh
>&
zones
,
const
word
&
setName
)
{
label
zoneID
=
zones
.
findZoneID
(
setName
);
if
(
zoneID
!=
-
1
)
{
Info
<<
"Removing zone "
<<
setName
<<
" at index "
<<
zoneID
<<
endl
;
// Shuffle to last position
labelList
oldToNew
(
zones
.
size
());
label
newI
=
0
;
forAll
(
oldToNew
,
i
)
{
if
(
i
!=
zoneID
)
{
oldToNew
[
i
]
=
newI
++
;
}
}
oldToNew
[
zoneID
]
=
newI
;
zones
.
reorder
(
oldToNew
);
// Remove last element
zones
.
setSize
(
zones
.
size
()
-
1
);
zones
.
clearAddressing
();
zones
.
write
();
}
}
// Physically remove a set
void
removeSet
(
const
polyMesh
&
mesh
,
const
word
&
setType
,
const
word
&
setName
)
{
// Remove the file
IOobjectList
objects
(
mesh
,
mesh
.
time
().
findInstance
(
polyMesh
::
meshSubDir
/
"sets"
,
word
::
null
,
IOobject
::
READ_IF_PRESENT
,
mesh
.
facesInstance
()
),
polyMesh
::
meshSubDir
/
"sets"
);
if
(
objects
.
found
(
setName
))
{
// Remove file
fileName
object
=
objects
[
setName
]
->
objectPath
();
Info
<<
"Removing file "
<<
object
<<
endl
;
rm
(
object
);
}
// See if zone
if
(
setType
==
cellZoneSet
::
typeName
)
{
removeZone
(
const_cast
<
cellZoneMesh
&>
(
mesh
.
cellZones
()),
setName
);
}
else
if
(
setType
==
faceZoneSet
::
typeName
)
{
removeZone
(
const_cast
<
faceZoneMesh
&>
(
mesh
.
faceZones
()),
setName
);
}
else
if
(
setType
==
pointZoneSet
::
typeName
)
{
removeZone
(
const_cast
<
pointZoneMesh
&>
(
mesh
.
pointZones
()),
setName
);
}
}
polyMesh
::
readUpdateState
meshReadUpdate
(
polyMesh
&
mesh
)
{
polyMesh
::
readUpdateState
stat
=
mesh
.
readUpdate
();
...
...
@@ -284,6 +378,12 @@ int main(int argc, char *argv[])
currentSet
().
write
();
break
;
case
topoSetSource
:
:
REMOVE
:
Info
<<
" Removing set"
<<
endl
;
removeSet
(
mesh
,
setType
,
setName
);
break
;
default:
WarningIn
(
args
.
executable
())
<<
"Unhandled action "
<<
action
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
applications/utilities/mesh/manipulation/topoSet/topoSetDict
+
9
−
1
View file @
f1aa8b5f
...
...
@@ -22,8 +22,15 @@ FoamFile
// type cellSet;
//
// // action to perform on set. Two types:
// // - require no source : clear/invert
// // - require no source : clear/invert/remove
// // clear : clears set or zone
// // invert : select all currently non-selected elements
// // remove : removes set or zone
// // - require source : new/add/delete/subset
// // new : create new set or zone from source
// // add : add source to contents
// // delete : deletes source from contents
// // subset : keeps elements both in contents and source
// action new;
//
// The source entry varies according to the type of set:
...
...
@@ -329,6 +336,7 @@ FoamFile
// faceSet f0; // name of faceSet
// cellSet c0; // name of cellSet of slave side
// }
//
actions
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment