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
20e528e8
Commit
20e528e8
authored
16 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
xfer constructors
parent
5640ed63
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OpenFOAM/meshes/polyMesh/polyMesh.C
+464
-0
464 additions, 0 deletions
src/OpenFOAM/meshes/polyMesh/polyMesh.C
with
464 additions
and
0 deletions
src/OpenFOAM/meshes/polyMesh/polyMesh.C
+
464
−
0
View file @
20e528e8
...
@@ -35,6 +35,8 @@ License
...
@@ -35,6 +35,8 @@ License
#include
"OSspecific.H"
#include
"OSspecific.H"
#include
"demandDrivenData.H"
#include
"demandDrivenData.H"
#include
"pointMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace
Foam
namespace
Foam
...
@@ -425,6 +427,162 @@ Foam::polyMesh::polyMesh
...
@@ -425,6 +427,162 @@ Foam::polyMesh::polyMesh
}
}
Foam
::
polyMesh
::
polyMesh
(
const
IOobject
&
io
,
const
xfer
<
pointField
>&
points
,
const
xfer
<
faceList
>&
faces
,
const
xfer
<
labelList
>&
owner
,
const
xfer
<
labelList
>&
neighbour
,
const
bool
syncPar
)
:
objectRegistry
(
io
),
primitiveMesh
(),
points_
(
IOobject
(
"points"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
points
),
faces_
(
IOobject
(
"faces"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
faces
),
owner_
(
IOobject
(
"owner"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
owner
),
neighbour_
(
IOobject
(
"neighbour"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
neighbour
),
clearedPrimitives_
(
false
),
boundary_
(
IOobject
(
"boundary"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
*
this
,
0
),
bounds_
(
points_
,
syncPar
),
directions_
(
Vector
<
label
>::
zero
),
pointZones_
(
IOobject
(
"pointZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
faceZones_
(
IOobject
(
"faceZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
cellZones_
(
IOobject
(
"cellZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
globalMeshDataPtr_
(
NULL
),
moving_
(
false
),
changing_
(
false
),
curMotionTimeIndex_
(
time
().
timeIndex
()),
oldPointsPtr_
(
NULL
)
{
// Check if the faces and cells are valid
forAll
(
faces_
,
faceI
)
{
const
face
&
curFace
=
faces_
[
faceI
];
if
(
min
(
curFace
)
<
0
||
max
(
curFace
)
>
points_
.
size
())
{
FatalErrorIn
(
"polyMesh::polyMesh
\n
"
"(
\n
"
" const IOobject& io,
\n
"
" const pointField& points,
\n
"
" const faceList& faces,
\n
"
" const cellList& cells
\n
"
")
\n
"
)
<<
"Face "
<<
faceI
<<
"contains vertex labels out of range: "
<<
curFace
<<
" Max point index = "
<<
points_
.
size
()
<<
abort
(
FatalError
);
}
}
// Set the primitive mesh
initMesh
();
}
Foam
::
polyMesh
::
polyMesh
Foam
::
polyMesh
::
polyMesh
(
(
const
IOobject
&
io
,
const
IOobject
&
io
,
...
@@ -602,6 +760,185 @@ Foam::polyMesh::polyMesh
...
@@ -602,6 +760,185 @@ Foam::polyMesh::polyMesh
}
}
Foam
::
polyMesh
::
polyMesh
(
const
IOobject
&
io
,
const
xfer
<
pointField
>&
points
,
const
xfer
<
faceList
>&
faces
,
const
xfer
<
cellList
>&
cells
,
const
bool
syncPar
)
:
objectRegistry
(
io
),
primitiveMesh
(),
points_
(
IOobject
(
"points"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
points
),
faces_
(
IOobject
(
"faces"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
faces
),
owner_
(
IOobject
(
"owner"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
0
),
neighbour_
(
IOobject
(
"neighbour"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
0
),
clearedPrimitives_
(
false
),
boundary_
(
IOobject
(
"boundary"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
*
this
,
0
),
bounds_
(
points_
,
syncPar
),
directions_
(
Vector
<
label
>::
zero
),
pointZones_
(
IOobject
(
"pointZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
faceZones_
(
IOobject
(
"faceZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
cellZones_
(
IOobject
(
"cellZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
*
this
,
0
),
globalMeshDataPtr_
(
NULL
),
moving_
(
false
),
changing_
(
false
),
curMotionTimeIndex_
(
time
().
timeIndex
()),
oldPointsPtr_
(
NULL
)
{
// Check if faces are valid
forAll
(
faces_
,
faceI
)
{
const
face
&
curFace
=
faces_
[
faceI
];
if
(
min
(
curFace
)
<
0
||
max
(
curFace
)
>
points_
.
size
())
{
FatalErrorIn
(
"polyMesh::polyMesh
\n
"
"(
\n
"
" const IOobject&,
\n
"
" const xfer<pointField>&,
\n
"
" const xfer<faceList>&,
\n
"
" const xfer<cellList>&
\n
"
")
\n
"
)
<<
"Face "
<<
faceI
<<
"contains vertex labels out of range: "
<<
curFace
<<
" Max point index = "
<<
points_
.
size
()
<<
abort
(
FatalError
);
}
}
const
cellList
&
cLst
=
cells
();
// Check if cells are valid
forAll
(
cLst
,
cellI
)
{
const
cell
&
curCell
=
cLst
[
cellI
];
if
(
min
(
curCell
)
<
0
||
max
(
curCell
)
>
faces_
.
size
())
{
FatalErrorIn
(
"polyMesh::polyMesh
\n
"
"(
\n
"
" const IOobject&,
\n
"
" const xfer<pointField>&,
\n
"
" const xfer<faceList>&,
\n
"
" const xfer<cellList>&
\n
"
")
\n
"
)
<<
"Cell "
<<
cellI
<<
"contains face labels out of range: "
<<
curCell
<<
" Max face index = "
<<
faces_
.
size
()
<<
abort
(
FatalError
);
}
}
// Set the primitive mesh
initMesh
(
cells
);
}
void
Foam
::
polyMesh
::
resetPrimitives
void
Foam
::
polyMesh
::
resetPrimitives
(
(
const
label
nUsedFaces
,
const
label
nUsedFaces
,
...
@@ -719,6 +1056,111 @@ void Foam::polyMesh::resetPrimitives
...
@@ -719,6 +1056,111 @@ void Foam::polyMesh::resetPrimitives
}
}
void
Foam
::
polyMesh
::
resetPrimitives
(
const
label
nUsedFaces
,
const
xfer
<
pointField
>&
points
,
const
xfer
<
faceList
>&
faces
,
const
xfer
<
labelList
>&
owner
,
const
xfer
<
labelList
>&
neighbour
,
const
labelList
&
patchSizes
,
const
labelList
&
patchStarts
,
const
bool
validBoundary
)
{
// Clear addressing. Keep geometric props for mapping.
clearAddressing
();
// Take over new primitive data.
points_
.
transfer
(
points
());
bounds_
=
boundBox
(
points_
,
validBoundary
);
faces_
.
transfer
(
faces
());
owner_
.
transfer
(
owner
());
neighbour_
.
transfer
(
neighbour
());
// Reset patch sizes and starts
forAll
(
boundary_
,
patchI
)
{
boundary_
[
patchI
]
=
polyPatch
(
boundary_
[
patchI
].
name
(),
patchSizes
[
patchI
],
patchStarts
[
patchI
],
patchI
,
boundary_
);
}
// Flags the mesh files as being changed
setInstance
(
time
().
timeName
());
// Check if the faces and cells are valid
forAll
(
faces_
,
faceI
)
{
const
face
&
curFace
=
faces_
[
faceI
];
if
(
min
(
curFace
)
<
0
||
max
(
curFace
)
>
points_
.
size
())
{
FatalErrorIn
(
"polyMesh::polyMesh::resetPrimitives
\n
"
"(
\n
"
" const label nUsedFaces,
\n
"
" const xfer<pointField>&,
\n
"
" const xfer<faceList>&,
\n
"
" const xfer<labelList>& owner,
\n
"
" const xfer<labelList>& neighbour,
\n
"
" const labelList& patchSizes,
\n
"
" const labelList& patchStarts
\n
"
")
\n
"
)
<<
"Face "
<<
faceI
<<
" contains vertex labels out of range: "
<<
curFace
<<
" Max point index = "
<<
points_
.
size
()
<<
abort
(
FatalError
);
}
}
// Set the primitive mesh from the owner_, neighbour_. Works
// out from patch end where the active faces stop.
initMesh
();
if
(
validBoundary
)
{
// Note that we assume that all the patches stay the same and are
// correct etc. so we can already use the patches to do
// processor-processor comms.
// Calculate topology for the patches (processor-processor comms etc.)
boundary_
.
updateMesh
();
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_
.
calcGeometry
();
// Warn if global empty mesh (constructs globalData!)
if
(
globalData
().
nTotalPoints
()
==
0
||
globalData
().
nTotalCells
()
==
0
)
{
FatalErrorIn
(
"polyMesh::polyMesh::resetPrimitives
\n
"
"(
\n
"
" const label nUsedFaces,
\n
"
" const xfer<pointField>&,
\n
"
" const xfer<faceList>&,
\n
"
" const xfer<labelList>& owner,
\n
"
" const xfer<labelList>& neighbour,
\n
"
" const labelList& patchSizes,
\n
"
" const labelList& patchStarts
\n
"
")
\n
"
)
<<
"no points or no cells in mesh"
<<
endl
;
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
polyMesh
::~
polyMesh
()
Foam
::
polyMesh
::~
polyMesh
()
...
@@ -1037,6 +1479,28 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
...
@@ -1037,6 +1479,28 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
faceZones_
.
movePoints
(
points_
);
faceZones_
.
movePoints
(
points_
);
cellZones_
.
movePoints
(
points_
);
cellZones_
.
movePoints
(
points_
);
// Hack until proper callbacks. Below are all the polyMeh MeshObjects with a
// movePoints function.
// pointMesh
if
(
db
().
objectRegistry
::
foundObject
<
pointMesh
>
(
pointMesh
::
typeName
)
)
{
const_cast
<
pointMesh
&>
(
db
().
objectRegistry
::
lookupObject
<
pointMesh
>
(
pointMesh
::
typeName
)
).
movePoints
(
points_
);
}
return
sweptVols
;
return
sweptVols
;
}
}
...
...
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