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
d69c2631
Commit
d69c2631
authored
Feb 19, 2018
by
Mark OLESEN
Browse files
STYLE: relocate geometryType enum to cloud class (issue
#721
)
parent
cbbb9753
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/fields/cloud/cloud.C
View file @
d69c2631
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -31,11 +31,19 @@ License
namespace
Foam
{
defineTypeNameAndDebug
(
cloud
,
0
);
const
word
cloud
::
prefix
(
"lagrangian"
);
word
cloud
::
defaultName
(
"defaultCloud"
);
}
const
Foam
::
word
Foam
::
cloud
::
prefix
(
"lagrangian"
);
Foam
::
word
Foam
::
cloud
::
defaultName
(
"defaultCloud"
);
const
Foam
::
Enum
<
Foam
::
cloud
::
geometryType
>
Foam
::
cloud
::
geometryTypeNames
{
{
geometryType
::
COORDINATES
,
"coordinates"
},
{
geometryType
::
POSITIONS
,
"positions"
}
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
cloud
::
cloud
(
const
objectRegistry
&
obr
,
const
word
&
cloudName
)
...
...
@@ -55,12 +63,6 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
cloud
::~
cloud
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
cloud
::
autoMap
(
const
mapPolyMesh
&
)
...
...
src/OpenFOAM/fields/cloud/cloud.H
View file @
d69c2631
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016
-2018
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -25,7 +25,7 @@ Class
Foam::cloud
Description
A cloud is a collection of lagrangian particles
A cloud is a
registry
collection of lagrangian particles
.
SourceFiles
cloud.C
...
...
@@ -36,6 +36,7 @@ SourceFiles
#define cloud_H
#include
"objectRegistry.H"
#include
"Enum.H"
#include
"IOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -58,14 +59,24 @@ class cloud
// Private Member Functions
//- Disallow default bitwise copy construct
cloud
(
const
cloud
&
);
cloud
(
const
cloud
&
)
=
delete
;
//- Disallow default bitwise assignment
void
operator
=
(
const
cloud
&
);
void
operator
=
(
const
cloud
&
)
=
delete
;
public:
//- Cloud geometry type (internal or IO representations)
enum
class
geometryType
{
COORDINATES
,
//!< barycentric coordinates
POSITIONS
//!< positions
};
static
const
Enum
<
geometryType
>
geometryTypeNames
;
//- Runtime type information
TypeName
(
"cloud"
);
...
...
@@ -83,7 +94,7 @@ public:
//- Destructor
virtual
~
cloud
();
virtual
~
cloud
()
=
default
;
// Member Functions
...
...
src/lagrangian/basic/Cloud/Cloud.C
View file @
d69c2631
...
...
@@ -79,7 +79,7 @@ Foam::Cloud<ParticleType>::Cloud
polyMesh_
(
pMesh
),
labels_
(),
globalPositionsPtr_
(),
geometryType_
(
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryType
::
COORDINATES
)
geometryType_
(
cloud
::
geometryType
::
COORDINATES
)
{
checkPatches
();
...
...
src/lagrangian/basic/Cloud/Cloud.H
View file @
d69c2631
...
...
@@ -109,7 +109,7 @@ class Cloud
protected:
//- Geometry type
typename
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryType
geometryType_
;
cloud
::
geometryType
geometryType_
;
public:
...
...
src/lagrangian/basic/Cloud/CloudIO.C
View file @
d69c2631
...
...
@@ -57,11 +57,11 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
// Fall back to positions mode if the entry is not present for
// backwards compatibility
geometryType_
=
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryTypeNames
_
.
lookupOrDefault
cloud
::
geometryTypeNames
.
lookupOrDefault
(
"geometry"
,
uniformPropsDict
,
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryType
::
POSITIONS
cloud
::
geometryType
::
POSITIONS
);
const
word
procName
(
"processor"
+
Foam
::
name
(
Pstream
::
myProcNo
()));
...
...
@@ -104,7 +104,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
uniformPropsDict
.
add
(
"geometry"
,
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryTypeNames
_
[
geometryType_
]
cloud
::
geometryTypeNames
[
geometryType_
]
);
forAll
(
np
,
i
)
...
...
@@ -146,8 +146,8 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
<<
"Assuming the initial cloud contains 0 particles."
<<
endl
;
}
// Always operate in co
-
ordinates mode after reading
geometryType_
=
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryType
::
COORDINATES
;
// Always operate in coordinates mode after reading
geometryType_
=
cloud
::
geometryType
::
COORDINATES
;
// Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then
...
...
@@ -170,7 +170,7 @@ Foam::Cloud<ParticleType>::Cloud
polyMesh_
(
pMesh
),
labels_
(),
cellWallFacesPtr_
(),
geometryType_
(
IOPosition
<
Cloud
<
ParticleType
>>
::
geometryType
::
COORDINATES
)
geometryType_
(
cloud
::
geometryType
::
COORDINATES
)
{
checkPatches
();
...
...
src/lagrangian/basic/IOPosition/IOPosition.C
View file @
d69c2631
...
...
@@ -23,31 +23,20 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template
<
class
CloudType
>
const
Foam
::
Enum
<
typename
Foam
::
IOPosition
<
CloudType
>::
geometryType
>
Foam
::
IOPosition
<
CloudType
>::
geometryTypeNames_
{
{
geometryType
::
POSITIONS
,
"positions"
},
{
geometryType
::
COORDINATES
,
"coordinates"
}
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
class
CloudType
>
Foam
::
IOPosition
<
CloudType
>::
IOPosition
(
const
CloudType
&
c
,
const
geometryType
&
geomType
const
cloud
::
geometryType
&
geomType
)
:
regIOobject
(
IOobject
(
geometryTypeNames
_
[
geomType
],
cloud
::
geometryTypeNames
[
geomType
],
c
.
time
().
timeName
(),
c
,
IOobject
::
MUST_READ
,
...
...
@@ -75,20 +64,20 @@ bool Foam::IOPosition<CloudType>::writeData(Ostream& os) const
switch
(
geometryType_
)
{
case
geometryType
:
:
POSITION
S
:
case
cloud
:
:
geometryType
::
COORDINATE
S
:
{
forAllConstIters
(
cloud_
,
iter
)
{
iter
().
write
Position
(
os
);
iter
().
write
Coordinates
(
os
);
os
<<
nl
;
}
break
;
}
case
geometryType
:
:
COORDINATE
S
:
case
cloud
:
:
geometryType
::
POSITION
S
:
{
forAllConstIters
(
cloud_
,
iter
)
{
iter
().
write
Coordinates
(
os
);
iter
().
write
Position
(
os
);
os
<<
nl
;
}
break
;
...
...
@@ -108,7 +97,7 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
token
firstToken
(
is
);
bool
newFormat
=
geometryType_
==
geometryType
::
COORDINATES
;
const
bool
newFormat
=
(
geometryType_
==
cloud
::
geometryType
::
COORDINATES
)
;
if
(
firstToken
.
isLabel
())
{
...
...
src/lagrangian/basic/IOPosition/IOPosition.H
View file @
d69c2631
...
...
@@ -35,8 +35,8 @@ SourceFiles
#ifndef IOPosition_H
#define IOPosition_H
#include
"cloud.H"
#include
"regIOobject.H"
#include
"Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -52,22 +52,9 @@ class IOPosition
:
public
regIOobject
{
public:
enum
class
geometryType
{
POSITIONS
,
COORDINATES
};
static
const
Enum
<
geometryType
>
geometryTypeNames_
;
private:
// Private data
geometryType
geometryType_
;
cloud
::
geometryType
geometryType_
;
//- Reference to the cloud
const
CloudType
&
cloud_
;
...
...
@@ -90,7 +77,8 @@ public:
IOPosition
(
const
CloudType
&
c
,
const
geometryType
&
geomType
=
geometryType
::
COORDINATES
const
cloud
::
geometryType
&
geomType
=
cloud
::
geometryType
::
COORDINATES
);
...
...
src/lagrangian/basic/injectedParticle/injectedParticleCloud.C
View file @
d69c2631
...
...
@@ -41,8 +41,7 @@ Foam::injectedParticleCloud::injectedParticleCloud
:
Cloud
<
injectedParticle
>
(
mesh
,
cloudName
,
false
)
{
geometryType_
=
IOPosition
<
Cloud
<
injectedParticle
>>::
geometryType
::
POSITIONS
;
geometryType_
=
cloud
::
geometryType
::
POSITIONS
;
if
(
readFields
)
{
...
...
src/lagrangian/basic/particle/particleTemplates.C
View file @
d69c2631
...
...
@@ -40,7 +40,7 @@ License
template
<
class
TrackCloudType
>
void
Foam
::
particle
::
readFields
(
TrackCloudType
&
c
)
{
bool
valid
=
c
.
size
();
const
bool
valid
=
c
.
size
();
IOobject
procIO
(
c
.
fieldIOobject
(
"origProcId"
,
IOobject
::
MUST_READ
));
...
...
@@ -70,7 +70,7 @@ void Foam::particle::readFields(TrackCloudType& c)
template
<
class
TrackCloudType
>
void
Foam
::
particle
::
writeFields
(
const
TrackCloudType
&
c
)
{
label
np
=
c
.
size
();
const
label
np
=
c
.
size
();
if
(
writeLagrangianCoordinates
)
{
...
...
@@ -84,7 +84,7 @@ void Foam::particle::writeFields(const TrackCloudType& c)
IOPosition
<
TrackCloudType
>
ioP
(
c
,
IOPosition
<
TrackCloudType
>
::
geometryType
::
POSITIONS
cloud
::
geometryType
::
POSITIONS
);
ioP
.
write
(
np
>
0
);
}
...
...
@@ -116,7 +116,7 @@ void Foam::particle::writeFields(const TrackCloudType& c)
template
<
class
CloudType
>
void
Foam
::
particle
::
writeObjects
(
const
CloudType
&
c
,
objectRegistry
&
obr
)
{
label
np
=
c
.
size
();
const
label
np
=
c
.
size
();
IOField
<
label
>&
origProc
(
cloud
::
createIOField
<
label
>
(
"origProc"
,
np
,
obr
));
IOField
<
label
>&
origId
(
cloud
::
createIOField
<
label
>
(
"origId"
,
np
,
obr
));
...
...
src/parallel/reconstruct/reconstruct/reconstructLagrangianPositions.C
View file @
d69c2631
...
...
@@ -84,7 +84,7 @@ void Foam::reconstructLagrangianPositions
IOPosition
<
Cloud
<
passiveParticle
>>
(
lagrangianPositions
,
IOPosition
<
Cloud
<
passiveParticle
>>
::
geometryType
::
POSITIONS
cloud
::
geometryType
::
POSITIONS
).
write
();
}
}
...
...
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