Skip to content
GitLab
Menu
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
f5e0f69b
Commit
f5e0f69b
authored
Jun 22, 2021
by
Mark Olesen
Browse files
ENH: fvMeshSubsetProxy resetZones, noexcept on some methods
parent
98aa92a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/dynamicMesh/fvMeshSubset/fvMeshSubset.H
View file @
f5e0f69b
...
...
@@ -73,7 +73,7 @@ namespace Foam
class
fvMeshSubset
{
// Private
d
ata
// Private
D
ata
//- Mesh to subset from
const
fvMesh
&
baseMesh_
;
...
...
@@ -214,13 +214,13 @@ public:
// Access
//- Original mesh
inline
const
fvMesh
&
baseMesh
()
const
;
inline
const
fvMesh
&
baseMesh
()
const
noexcept
;
//- Return baseMesh or subMesh, depending on the current state.
inline
const
fvMesh
&
mesh
()
const
;
inline
const
fvMesh
&
mesh
()
const
noexcept
;
//- Have subMesh?
inline
bool
hasSubMesh
()
const
;
inline
bool
hasSubMesh
()
const
noexcept
;
//- Return reference to subset mesh
inline
const
fvMesh
&
subMesh
()
const
;
...
...
@@ -491,7 +491,6 @@ public:
syncCouples
);
}
};
...
...
src/dynamicMesh/fvMeshSubset/fvMeshSubsetI.H
View file @
f5e0f69b
...
...
@@ -27,19 +27,19 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline
const
Foam
::
fvMesh
&
Foam
::
fvMeshSubset
::
baseMesh
()
const
inline
const
Foam
::
fvMesh
&
Foam
::
fvMeshSubset
::
baseMesh
()
const
noexcept
{
return
baseMesh_
;
}
inline
const
Foam
::
fvMesh
&
Foam
::
fvMeshSubset
::
mesh
()
const
inline
const
Foam
::
fvMesh
&
Foam
::
fvMeshSubset
::
mesh
()
const
noexcept
{
return
fvMeshSubsetPtr_
?
*
fvMeshSubsetPtr_
:
baseMesh_
;
}
inline
bool
Foam
::
fvMeshSubset
::
hasSubMesh
()
const
inline
bool
Foam
::
fvMeshSubset
::
hasSubMesh
()
const
noexcept
{
return
bool
(
fvMeshSubsetPtr_
);
}
...
...
src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxy.C
View file @
f5e0f69b
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-201
9
OpenCFD Ltd.
Copyright (C) 2016-20
2
1 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -30,6 +30,18 @@ License
#include
"cellZone.H"
#include
"Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void
Foam
::
fvMeshSubsetProxy
::
clearOut
()
{
subsetter_
.
clear
();
type_
=
subsetType
::
NONE
;
name_
.
clear
();
names_
.
clear
();
selectedCells_
.
clearStorage
();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
fvMeshSubsetProxy
::
fvMeshSubsetProxy
(
fvMesh
&
baseMesh
)
...
...
@@ -37,16 +49,11 @@ Foam::fvMeshSubsetProxy::fvMeshSubsetProxy(fvMesh& baseMesh)
baseMesh_
(
baseMesh
),
subsetter_
(
baseMesh
),
exposedPatchId_
(
-
1
),
type_
(
NONE
),
type_
(
subsetType
::
NONE
),
name_
(),
names_
(),
selectedCells_
()
{
if
(
useSubMesh
())
{
correct
();
}
}
{}
Foam
::
fvMeshSubsetProxy
::
fvMeshSubsetProxy
...
...
@@ -60,26 +67,23 @@ Foam::fvMeshSubsetProxy::fvMeshSubsetProxy
baseMesh_
(
baseMesh
),
subsetter_
(
baseMesh
),
exposedPatchId_
(
exposedPatchId
),
type_
(
selectionName
.
empty
()
?
NONE
:
type
),
type_
(
selectionName
.
empty
()
?
subsetType
::
NONE
:
type
),
name_
(),
names_
(),
selectedCells_
()
{
if
(
type_
==
ZONES
)
if
(
type_
==
subsetType
::
ZONES
)
{
// Populate wordRes for ZONES
names_
.
resize
(
1
);
names_
.
first
()
=
selectionName
;
}
else
if
(
type_
!
=
N
ONE
)
else
if
(
type_
=
=
subsetType
::
SET
||
type_
==
subsetType
::
Z
ONE
)
{
name_
=
selectionName
;
}
if
(
useSubMesh
())
{
correct
();
}
correct
();
}
...
...
@@ -93,15 +97,12 @@ Foam::fvMeshSubsetProxy::fvMeshSubsetProxy
baseMesh_
(
baseMesh
),
subsetter_
(
baseMesh
),
exposedPatchId_
(
exposedPatchId
),
type_
(
ZONES
),
type_
(
subsetType
::
ZONES
),
name_
(),
names_
(
zoneNames
),
selectedCells_
()
{
if
(
useSubMesh
())
{
correct
();
}
correct
();
}
...
...
@@ -115,23 +116,33 @@ Foam::fvMeshSubsetProxy::fvMeshSubsetProxy
baseMesh_
(
baseMesh
),
subsetter_
(
baseMesh
),
exposedPatchId_
(
exposedPatchId
),
type_
(
ZONES
),
type_
(
subsetType
::
ZONES
),
name_
(),
names_
(
std
::
move
(
zoneNames
)),
selectedCells_
()
{
if
(
useSubMesh
())
correct
();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
fvMeshSubsetProxy
::
resetZones
(
const
wordRes
&
zoneNames
)
{
fvMeshSubsetProxy
::
clearOut
();
if
(
!
zoneNames
.
empty
())
{
type_
=
subsetType
::
ZONES
;
names_
=
zoneNames
;
correct
();
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool
Foam
::
fvMeshSubsetProxy
::
correct
(
bool
verbose
)
{
if
(
type_
==
NONE
)
if
(
type_
==
subsetType
::
NONE
)
{
subsetter_
.
clear
();
selectedCells_
.
clearStorage
();
...
...
@@ -142,7 +153,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
bitSet
selectedCells
;
if
(
type_
==
SET
)
if
(
type_
==
subsetType
::
SET
)
{
if
(
verbose
)
{
...
...
@@ -157,7 +168,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
selectedCells
.
set
(
idx
);
}
}
else
if
(
type_
==
ZONE
)
else
if
(
type_
==
subsetType
::
ZONE
)
{
if
(
verbose
)
{
...
...
@@ -167,7 +178,7 @@ bool Foam::fvMeshSubsetProxy::correct(bool verbose)
selectedCells
.
resize
(
nCells
);
selectedCells
.
set
(
baseMesh_
.
cellZones
()[
name_
]);
}
else
if
(
type_
==
ZONES
)
else
if
(
type_
==
subsetType
::
ZONES
)
{
if
(
verbose
)
{
...
...
src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxy.H
View file @
f5e0f69b
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-202
0
OpenCFD Ltd.
Copyright (C) 2016-202
1
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -97,6 +97,9 @@ private:
// Private Member Functions
//- Clear, set to NONE
void
clearOut
();
//- No copy construct
fvMeshSubsetProxy
(
const
fvMeshSubsetProxy
&
)
=
delete
;
...
...
@@ -142,21 +145,27 @@ public:
// Access
//- The entire base mesh
inline
const
fvMesh
&
baseMesh
()
const
const
fvMesh
&
baseMesh
()
const
noexcept
{
return
baseMesh_
;
}
//- The mesh subsetter
inline
const
fvMeshSubset
&
subsetter
()
const
const
fvMeshSubset
&
subsetter
()
const
noexcept
{
return
subsetter_
;
}
//-
C
he
ck if a sub-mesh is being used
inline
bool
useSubMesh
()
cons
t
//-
T
he
mesh subsetter
fvMeshSubset
&
subsetter
()
noexcep
t
{
return
type_
!=
NONE
;
return
subsetter_
;
}
//- True if sub-mesh should be used
bool
useSubMesh
()
const
noexcept
{
return
type_
!=
subsetType
::
NONE
;
}
//- Access either base-mesh or sub-mesh
...
...
@@ -171,13 +180,13 @@ public:
}
//- The associated (set or zone) name if any.
inline
const
word
&
name
()
const
const
word
&
name
()
const
noexcept
{
return
name_
;
}
//- The current cell selection, when subsetting is active
inline
const
bitSet
&
selectedCells
()
const
const
bitSet
&
selectedCells
()
const
noexcept
{
return
selectedCells_
;
}
...
...
@@ -185,6 +194,9 @@ public:
// Edit
//- Define the zones selection, subset the mesh accordingly
void
resetZones
(
const
wordRes
&
zoneNames
);
//- Update of mesh subset.
// Return true if the subset changed from previous call.
bool
correct
(
bool
verbose
=
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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