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
ba697974
Commit
ba697974
authored
Oct 24, 2008
by
Mark Olesen
Browse files
optimize polyMesh::resetPrimitives for 'null' parameters
parent
2023ab6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/polyMesh/polyMesh.C
View file @
ba697974
...
...
@@ -954,22 +954,23 @@ void Foam::polyMesh::resetPrimitives
// Clear addressing. Keep geometric props for mapping.
clearAddressing
();
// Take over new primitive data. Note extra optimization to prevent
// assignment to self.
if
(
&
points_
!=
&
points
)
// Take over new primitive data.
// Optimized to prevent self-assignment to self and
// to avoid overwriting data at all
if
(
&
points
&&
&
points_
!=
&
points
)
{
points_
=
points
;
bounds_
=
boundBox
(
points_
,
validBoundary
);
}
if
(
&
faces_
!=
&
faces
)
if
(
&
faces
&&
&
faces
_
!=
&
faces
)
{
faces_
=
faces
;
}
if
(
&
owner_
!=
&
owner
)
if
(
&
owner
&&
&
owner
_
!=
&
owner
)
{
owner_
=
owner
;
}
if
(
&
neighbour_
!=
&
neighbour
)
if
(
&
neighbour
&&
&
neighbour
_
!=
&
neighbour
)
{
neighbour_
=
neighbour
;
}
...
...
@@ -1072,12 +1073,28 @@ void Foam::polyMesh::resetPrimitives
clearAddressing
();
// Take over new primitive data.
points_
.
transfer
(
points
());
bounds_
=
boundBox
(
points_
,
validBoundary
);
// Optimized to avoid overwriting data at all
if
(
&
points
)
{
points_
.
transfer
(
points
());
bounds_
=
boundBox
(
points_
,
validBoundary
);
}
if
(
&
faces
)
{
faces_
.
transfer
(
faces
());
}
if
(
&
owner
)
{
owner_
.
transfer
(
owner
());
}
if
(
&
neighbour
)
{
neighbour_
.
transfer
(
neighbour
());
}
faces_
.
transfer
(
faces
());
owner_
.
transfer
(
owner
());
neighbour_
.
transfer
(
neighbour
());
// Reset patch sizes and starts
forAll
(
boundary_
,
patchI
)
...
...
@@ -1306,9 +1323,9 @@ void Foam::polyMesh::addZones
(
"void addZones
\n
"
"(
\n
"
" const List<pointZone*>&
pz
,
\n
"
" const List<faceZone*>&
fz
,
\n
"
" const List<cellZone*>&
cz
\n
"
" const List<pointZone*>&,
\n
"
" const List<faceZone*>&,
\n
"
" const List<cellZone*>&
\n
"
")"
)
<<
"point, face or cell zone already exists"
<<
abort
(
FatalError
);
...
...
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