mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: IO Improvements, seg fault in parallel needing found.
This commit is contained in:
@ -70,8 +70,11 @@ Usage
|
|||||||
#include "vectorIOField.H"
|
#include "vectorIOField.H"
|
||||||
#include "vectorFieldIOField.H"
|
#include "vectorFieldIOField.H"
|
||||||
#include "sphericalTensorIOField.H"
|
#include "sphericalTensorIOField.H"
|
||||||
|
#include "sphericalTensorFieldIOField.H"
|
||||||
#include "symmTensorIOField.H"
|
#include "symmTensorIOField.H"
|
||||||
|
#include "symmTensorFieldIOField.H"
|
||||||
#include "tensorIOField.H"
|
#include "tensorIOField.H"
|
||||||
|
#include "tensorFieldIOField.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
@ -395,14 +398,24 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
cloudDirs.size()
|
cloudDirs.size()
|
||||||
);
|
);
|
||||||
|
PtrList<PtrList<sphericalTensorIOFieldField> >
|
||||||
|
lagrangianSphericalTensorFieldFields(cloudDirs.size());
|
||||||
PtrList<PtrList<symmTensorIOField> > lagrangianSymmTensorFields
|
PtrList<PtrList<symmTensorIOField> > lagrangianSymmTensorFields
|
||||||
(
|
(
|
||||||
cloudDirs.size()
|
cloudDirs.size()
|
||||||
);
|
);
|
||||||
|
PtrList<PtrList<symmTensorIOFieldField> > lagrangianSymmTensorFieldFields
|
||||||
|
(
|
||||||
|
cloudDirs.size()
|
||||||
|
);
|
||||||
PtrList<PtrList<tensorIOField> > lagrangianTensorFields
|
PtrList<PtrList<tensorIOField> > lagrangianTensorFields
|
||||||
(
|
(
|
||||||
cloudDirs.size()
|
cloudDirs.size()
|
||||||
);
|
);
|
||||||
|
PtrList<PtrList<tensorIOFieldField> > lagrangianTensorFieldFields
|
||||||
|
(
|
||||||
|
cloudDirs.size()
|
||||||
|
);
|
||||||
|
|
||||||
label cloudI = 0;
|
label cloudI = 0;
|
||||||
|
|
||||||
@ -545,6 +558,13 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianSphericalTensorFields
|
lagrangianSphericalTensorFields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
lagrangianFieldDecomposer::readFieldFields
|
||||||
|
(
|
||||||
|
cloudI,
|
||||||
|
lagrangianObjects,
|
||||||
|
lagrangianSphericalTensorFieldFields
|
||||||
|
);
|
||||||
|
|
||||||
lagrangianFieldDecomposer::readFields
|
lagrangianFieldDecomposer::readFields
|
||||||
(
|
(
|
||||||
cloudI,
|
cloudI,
|
||||||
@ -552,6 +572,13 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianSymmTensorFields
|
lagrangianSymmTensorFields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
lagrangianFieldDecomposer::readFieldFields
|
||||||
|
(
|
||||||
|
cloudI,
|
||||||
|
lagrangianObjects,
|
||||||
|
lagrangianSymmTensorFieldFields
|
||||||
|
);
|
||||||
|
|
||||||
lagrangianFieldDecomposer::readFields
|
lagrangianFieldDecomposer::readFields
|
||||||
(
|
(
|
||||||
cloudI,
|
cloudI,
|
||||||
@ -559,6 +586,13 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianTensorFields
|
lagrangianTensorFields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
lagrangianFieldDecomposer::readFieldFields
|
||||||
|
(
|
||||||
|
cloudI,
|
||||||
|
lagrangianObjects,
|
||||||
|
lagrangianTensorFieldFields
|
||||||
|
);
|
||||||
|
|
||||||
cloudI++;
|
cloudI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -572,8 +606,11 @@ int main(int argc, char *argv[])
|
|||||||
lagrangianVectorFields.setSize(cloudI);
|
lagrangianVectorFields.setSize(cloudI);
|
||||||
lagrangianVectorFieldFields.setSize(cloudI);
|
lagrangianVectorFieldFields.setSize(cloudI);
|
||||||
lagrangianSphericalTensorFields.setSize(cloudI);
|
lagrangianSphericalTensorFields.setSize(cloudI);
|
||||||
|
lagrangianSphericalTensorFieldFields.setSize(cloudI);
|
||||||
lagrangianSymmTensorFields.setSize(cloudI);
|
lagrangianSymmTensorFields.setSize(cloudI);
|
||||||
|
lagrangianSymmTensorFieldFields.setSize(cloudI);
|
||||||
lagrangianTensorFields.setSize(cloudI);
|
lagrangianTensorFields.setSize(cloudI);
|
||||||
|
lagrangianTensorFieldFields.setSize(cloudI);
|
||||||
|
|
||||||
|
|
||||||
// Any uniform data to copy/link?
|
// Any uniform data to copy/link?
|
||||||
@ -771,8 +808,11 @@ int main(int argc, char *argv[])
|
|||||||
|| lagrangianVectorFields[cloudI].size()
|
|| lagrangianVectorFields[cloudI].size()
|
||||||
|| lagrangianVectorFieldFields[cloudI].size()
|
|| lagrangianVectorFieldFields[cloudI].size()
|
||||||
|| lagrangianSphericalTensorFields[cloudI].size()
|
|| lagrangianSphericalTensorFields[cloudI].size()
|
||||||
|
|| lagrangianSphericalTensorFieldFields[cloudI].size()
|
||||||
|| lagrangianSymmTensorFields[cloudI].size()
|
|| lagrangianSymmTensorFields[cloudI].size()
|
||||||
|
|| lagrangianSymmTensorFieldFields[cloudI].size()
|
||||||
|| lagrangianTensorFields[cloudI].size()
|
|| lagrangianTensorFields[cloudI].size()
|
||||||
|
|| lagrangianTensorFieldFields[cloudI].size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldDecomposer.decomposeFields
|
fieldDecomposer.decomposeFields
|
||||||
@ -810,16 +850,31 @@ int main(int argc, char *argv[])
|
|||||||
cloudDirs[cloudI],
|
cloudDirs[cloudI],
|
||||||
lagrangianSphericalTensorFields[cloudI]
|
lagrangianSphericalTensorFields[cloudI]
|
||||||
);
|
);
|
||||||
|
fieldDecomposer.decomposeFieldFields
|
||||||
|
(
|
||||||
|
cloudDirs[cloudI],
|
||||||
|
lagrangianSphericalTensorFieldFields[cloudI]
|
||||||
|
);
|
||||||
fieldDecomposer.decomposeFields
|
fieldDecomposer.decomposeFields
|
||||||
(
|
(
|
||||||
cloudDirs[cloudI],
|
cloudDirs[cloudI],
|
||||||
lagrangianSymmTensorFields[cloudI]
|
lagrangianSymmTensorFields[cloudI]
|
||||||
);
|
);
|
||||||
|
fieldDecomposer.decomposeFieldFields
|
||||||
|
(
|
||||||
|
cloudDirs[cloudI],
|
||||||
|
lagrangianSymmTensorFieldFields[cloudI]
|
||||||
|
);
|
||||||
fieldDecomposer.decomposeFields
|
fieldDecomposer.decomposeFields
|
||||||
(
|
(
|
||||||
cloudDirs[cloudI],
|
cloudDirs[cloudI],
|
||||||
lagrangianTensorFields[cloudI]
|
lagrangianTensorFields[cloudI]
|
||||||
);
|
);
|
||||||
|
fieldDecomposer.decomposeFieldFields
|
||||||
|
(
|
||||||
|
cloudDirs[cloudI],
|
||||||
|
lagrangianTensorFieldFields[cloudI]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -444,6 +444,13 @@ int main(int argc, char *argv[])
|
|||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
|
reconstructLagrangianFieldFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
cloudName,
|
||||||
|
mesh,
|
||||||
|
procMeshes.meshes(),
|
||||||
|
sprayObjs
|
||||||
|
);
|
||||||
reconstructLagrangianFields<symmTensor>
|
reconstructLagrangianFields<symmTensor>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
@ -451,6 +458,13 @@ int main(int argc, char *argv[])
|
|||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
|
reconstructLagrangianFieldFields<symmTensor>
|
||||||
|
(
|
||||||
|
cloudName,
|
||||||
|
mesh,
|
||||||
|
procMeshes.meshes(),
|
||||||
|
sprayObjs
|
||||||
|
);
|
||||||
reconstructLagrangianFields<tensor>
|
reconstructLagrangianFields<tensor>
|
||||||
(
|
(
|
||||||
cloudName,
|
cloudName,
|
||||||
@ -458,6 +472,13 @@ int main(int argc, char *argv[])
|
|||||||
procMeshes.meshes(),
|
procMeshes.meshes(),
|
||||||
sprayObjs
|
sprayObjs
|
||||||
);
|
);
|
||||||
|
reconstructLagrangianFieldFields<tensor>
|
||||||
|
(
|
||||||
|
cloudName,
|
||||||
|
mesh,
|
||||||
|
procMeshes.meshes(),
|
||||||
|
sprayObjs
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -38,6 +38,7 @@ SourceFiles
|
|||||||
#include "cloud.H"
|
#include "cloud.H"
|
||||||
#include "IDLList.H"
|
#include "IDLList.H"
|
||||||
#include "IOField.H"
|
#include "IOField.H"
|
||||||
|
#include "IOFieldField.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -267,6 +268,14 @@ public:
|
|||||||
const IOField<DataType>& data
|
const IOField<DataType>& data
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Check lagrangian data fieldfield
|
||||||
|
template<class DataType>
|
||||||
|
void checkFieldFieldIOobject
|
||||||
|
(
|
||||||
|
const Cloud<ParticleType>& c,
|
||||||
|
const IOFieldField<Field<DataType>, DataType>& data
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read the field data for the cloud of particles. Dummy at
|
//- Read the field data for the cloud of particles. Dummy at
|
||||||
// this level.
|
// this level.
|
||||||
virtual void readFields();
|
virtual void readFields();
|
||||||
|
|||||||
@ -205,6 +205,31 @@ void Foam::Cloud<ParticleType>::checkFieldIOobject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParticleType>
|
||||||
|
template<class DataType>
|
||||||
|
void Foam::Cloud<ParticleType>::checkFieldFieldIOobject
|
||||||
|
(
|
||||||
|
const Cloud<ParticleType>& c,
|
||||||
|
const IOFieldField<Field<DataType>, DataType>& data
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (data.size() != c.size())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Cloud<ParticleType>::checkFieldFieldIOobject"
|
||||||
|
"("
|
||||||
|
"const Cloud<ParticleType>&, "
|
||||||
|
"const IOFieldField<Field<DataType>, DataType>&"
|
||||||
|
") const"
|
||||||
|
) << "Size of " << data.name()
|
||||||
|
<< " field " << data.size()
|
||||||
|
<< " does not match the number of particles " << c.size()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParticleType>
|
template<class ParticleType>
|
||||||
void Foam::Cloud<ParticleType>::readFields()
|
void Foam::Cloud<ParticleType>::readFields()
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -51,6 +51,104 @@ Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList
|
||||||
|
(
|
||||||
|
const labelField& pairAccessed,
|
||||||
|
const labelField& pairOrigProcOfOther,
|
||||||
|
const labelField& pairOrigIdOfOther,
|
||||||
|
const Field<PairType>& pairData,
|
||||||
|
const labelField& wallAccessed,
|
||||||
|
const vectorField& wallPRel,
|
||||||
|
const Field<WallType>& wallData
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pairRecords_(),
|
||||||
|
wallRecords_()
|
||||||
|
{
|
||||||
|
label nPair = pairAccessed.size();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
pairOrigProcOfOther.size() != nPair
|
||||||
|
|| pairOrigIdOfOther.size() != nPair
|
||||||
|
|| pairData.size() != nPair
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
|
||||||
|
"("
|
||||||
|
"const labelField& pairAccessed,"
|
||||||
|
"const labelField& pairOrigProcOfOther,"
|
||||||
|
"const labelField& pairOrigIdOfOther,"
|
||||||
|
"const Field<PairType>& pairData,"
|
||||||
|
"const labelField& wallAccessed,"
|
||||||
|
"const vectorField& wallPRel,"
|
||||||
|
"const Field<WallType>& wallData"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "Pair field size mismatch." << nl
|
||||||
|
<< pairAccessed << nl
|
||||||
|
<< pairOrigProcOfOther << nl
|
||||||
|
<< pairOrigIdOfOther << nl
|
||||||
|
<< pairData << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(pairAccessed, i)
|
||||||
|
{
|
||||||
|
pairRecords_.append
|
||||||
|
(
|
||||||
|
PairCollisionRecord<PairType>
|
||||||
|
(
|
||||||
|
pairAccessed[i],
|
||||||
|
pairOrigProcOfOther[i],
|
||||||
|
pairOrigIdOfOther[i],
|
||||||
|
pairData[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
label nWall = wallAccessed.size();
|
||||||
|
|
||||||
|
if (wallPRel.size() != nWall || wallData.size() != nWall)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
|
||||||
|
"("
|
||||||
|
"const labelField& pairAccessed,"
|
||||||
|
"const labelField& pairOrigProcOfOther,"
|
||||||
|
"const labelField& pairOrigIdOfOther,"
|
||||||
|
"const Field<PairType>& pairData,"
|
||||||
|
"const labelField& wallAccessed,"
|
||||||
|
"const vectorField& wallPRel,"
|
||||||
|
"const Field<WallType>& wallData"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "Wall field size mismatch." << nl
|
||||||
|
<< wallAccessed << nl
|
||||||
|
<< wallPRel << nl
|
||||||
|
<< wallData << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(wallAccessed, i)
|
||||||
|
{
|
||||||
|
wallRecords_.append
|
||||||
|
(
|
||||||
|
WallCollisionRecord<WallType>
|
||||||
|
(
|
||||||
|
wallAccessed[i],
|
||||||
|
wallPRel[i],
|
||||||
|
wallData[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
|
||||||
|
|
||||||
template<class PairType, class WallType>
|
template<class PairType, class WallType>
|
||||||
@ -60,6 +158,51 @@ Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::labelField
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::pairAccessed() const
|
||||||
|
{
|
||||||
|
labelField f(pairRecords_.size());
|
||||||
|
|
||||||
|
forAll(pairRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = pairRecords_[i].accessed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::labelField
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::pairOrigProcOfOther() const
|
||||||
|
{
|
||||||
|
labelField f(pairRecords_.size());
|
||||||
|
|
||||||
|
forAll(pairRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = pairRecords_[i].origProcOfOther();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::labelField
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::pairOrigIdOfOther() const
|
||||||
|
{
|
||||||
|
labelField f(pairRecords_.size());
|
||||||
|
|
||||||
|
forAll(pairRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = pairRecords_[i].origIdOfOther();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class PairType, class WallType>
|
template<class PairType, class WallType>
|
||||||
Foam::Field<PairType>
|
Foam::Field<PairType>
|
||||||
Foam::CollisionRecordList<PairType, WallType>::pairData() const
|
Foam::CollisionRecordList<PairType, WallType>::pairData() const
|
||||||
@ -75,6 +218,51 @@ Foam::CollisionRecordList<PairType, WallType>::pairData() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::labelField
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::wallAccessed() const
|
||||||
|
{
|
||||||
|
labelField f(wallRecords_.size());
|
||||||
|
|
||||||
|
forAll(wallRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = wallRecords_[i].accessed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::vectorField
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::wallPRel() const
|
||||||
|
{
|
||||||
|
vectorField f(wallRecords_.size());
|
||||||
|
|
||||||
|
forAll(wallRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = wallRecords_[i].pRel();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class PairType, class WallType>
|
||||||
|
Foam::Field<WallType>
|
||||||
|
Foam::CollisionRecordList<PairType, WallType>::wallData() const
|
||||||
|
{
|
||||||
|
Field<WallType> f(wallRecords_.size());
|
||||||
|
|
||||||
|
forAll(wallRecords_, i)
|
||||||
|
{
|
||||||
|
f[i] = wallRecords_[i].collisionData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class PairType, class WallType>
|
template<class PairType, class WallType>
|
||||||
Foam::PairCollisionRecord<PairType>&
|
Foam::PairCollisionRecord<PairType>&
|
||||||
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
|
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
|
||||||
@ -100,12 +288,12 @@ Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record not found, create a new one and return it as the last
|
// Record not found, create a new one and return it as the last
|
||||||
// member of the list. The status of the record will be accessed
|
// member of the list. Setting the status of the record to be accessed
|
||||||
// by construction.
|
// on construction.
|
||||||
|
|
||||||
pairRecords_.append
|
pairRecords_.append
|
||||||
(
|
(
|
||||||
PairCollisionRecord<PairType>(origProcOfOther, origIdOfOther)
|
PairCollisionRecord<PairType>(true, origProcOfOther, origIdOfOther)
|
||||||
);
|
);
|
||||||
|
|
||||||
return pairRecords_.last();
|
return pairRecords_.last();
|
||||||
@ -136,10 +324,10 @@ Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record not found, create a new one and return it as the last
|
// Record not found, create a new one and return it as the last
|
||||||
// member of the list. The status of the record will be accessed
|
// member of the list. Setting the status of the record to be accessed
|
||||||
// by construction.
|
// on construction.
|
||||||
|
|
||||||
wallRecords_.append(WallCollisionRecord<WallType>(pRel));
|
wallRecords_.append(WallCollisionRecord<WallType>(true, pRel));
|
||||||
|
|
||||||
return wallRecords_.last();
|
return wallRecords_.last();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,6 +95,17 @@ public:
|
|||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
CollisionRecordList(Istream&);
|
CollisionRecordList(Istream&);
|
||||||
|
|
||||||
|
//- Construct from component fields (for IO)
|
||||||
|
CollisionRecordList
|
||||||
|
(
|
||||||
|
const labelField& pairAccessed,
|
||||||
|
const labelField& pairOrigProcOfOther,
|
||||||
|
const labelField& pairOrigIdOfOther,
|
||||||
|
const Field<PairType>& pairData,
|
||||||
|
const labelField& wallAccessed,
|
||||||
|
const vectorField& wallPRel,
|
||||||
|
const Field<WallType>& wallData
|
||||||
|
);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~CollisionRecordList();
|
~CollisionRecordList();
|
||||||
@ -110,9 +121,42 @@ public:
|
|||||||
inline const DynamicList<WallCollisionRecord<WallType> >&
|
inline const DynamicList<WallCollisionRecord<WallType> >&
|
||||||
wallRecords() const;
|
wallRecords() const;
|
||||||
|
|
||||||
|
// Fields representing the data from each record, i.e if the
|
||||||
|
// records 0-N containing each data members {a, b, c, d...}
|
||||||
|
// are organised:
|
||||||
|
//
|
||||||
|
// a0 b0 c0 d0 ...
|
||||||
|
// a1 b1 c1 d1 ...
|
||||||
|
// a2 b2 c2 d2 ...
|
||||||
|
// ...
|
||||||
|
// aN bN cN dN ...
|
||||||
|
//
|
||||||
|
// Then these field return, for example, (c0, c1, c2,... cN)
|
||||||
|
|
||||||
|
//- Return field of pair accessed from each record, used for
|
||||||
|
// field IO
|
||||||
|
labelField pairAccessed() const;
|
||||||
|
|
||||||
|
//- Return field of pair origProcOfOther from each record,
|
||||||
|
// used for field IO
|
||||||
|
labelField pairOrigProcOfOther() const;
|
||||||
|
|
||||||
|
//- Return field of pair origIdOfOther from each record, used
|
||||||
|
// for field IO
|
||||||
|
labelField pairOrigIdOfOther() const;
|
||||||
|
|
||||||
//- Return field of pair data from each record, used for field IO
|
//- Return field of pair data from each record, used for field IO
|
||||||
Field<PairType> pairData() const;
|
Field<PairType> pairData() const;
|
||||||
|
|
||||||
|
//- Return field of wall accessed from each record, used for field IO
|
||||||
|
labelField wallAccessed() const;
|
||||||
|
|
||||||
|
//- Return field of wall pRel from each record, used for field IO
|
||||||
|
vectorField wallPRel() const;
|
||||||
|
|
||||||
|
//- Return field of wall data from each record, used for field IO
|
||||||
|
Field<WallType> wallData() const;
|
||||||
|
|
||||||
//- Enquires if the proc and id pair of the other particle are
|
//- Enquires if the proc and id pair of the other particle are
|
||||||
// present in the records. If so, return non-const access to
|
// present in the records. If so, return non-const access to
|
||||||
// the PairCollisionRecord (hence the data) and mark the
|
// the PairCollisionRecord (hence the data) and mark the
|
||||||
|
|||||||
@ -30,8 +30,8 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord()
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord()
|
||||||
:
|
:
|
||||||
origProcOfOther_(-VGREAT),
|
origProcOfOther_(0),
|
||||||
origIdOfOther_(-VGREAT),
|
origIdOfOther_(-1),
|
||||||
data_(pTraits<Type>::zero)
|
data_(pTraits<Type>::zero)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord()
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
||||||
(
|
(
|
||||||
|
bool accessed,
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther,
|
label origIdOfOther,
|
||||||
const Type& data
|
const Type& data
|
||||||
@ -47,7 +48,14 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
|||||||
origProcOfOther_(origProcOfOther + 1),
|
origProcOfOther_(origProcOfOther + 1),
|
||||||
origIdOfOther_(origIdOfOther),
|
origIdOfOther_(origIdOfOther),
|
||||||
data_(data)
|
data_(data)
|
||||||
{}
|
{
|
||||||
|
// Default assignment to origProcOfOther_ assumes accessed is true
|
||||||
|
|
||||||
|
if (!accessed)
|
||||||
|
{
|
||||||
|
setUnaccessed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -56,7 +64,7 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord
|
|||||||
const PairCollisionRecord<Type>& pCR
|
const PairCollisionRecord<Type>& pCR
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
origProcOfOther_(pCR.origProcOfOther() + 1),
|
origProcOfOther_(pCR.origProcOfOther_),
|
||||||
origIdOfOther_(pCR.origIdOfOther_),
|
origIdOfOther_(pCR.origIdOfOther_),
|
||||||
data_(pCR.data_)
|
data_(pCR.data_)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -108,6 +108,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
PairCollisionRecord
|
PairCollisionRecord
|
||||||
(
|
(
|
||||||
|
bool accessed,
|
||||||
label origProcOfOther,
|
label origProcOfOther,
|
||||||
label origIdOfOther,
|
label origIdOfOther,
|
||||||
const Type& data = pTraits<Type>::zero
|
const Type& data = pTraits<Type>::zero
|
||||||
|
|||||||
@ -45,11 +45,12 @@ Foam::WallCollisionRecord<Type>::WallCollisionRecord()
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::WallCollisionRecord<Type>::WallCollisionRecord
|
Foam::WallCollisionRecord<Type>::WallCollisionRecord
|
||||||
(
|
(
|
||||||
|
bool accessed,
|
||||||
const vector& pRel,
|
const vector& pRel,
|
||||||
const Type& data
|
const Type& data
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
accessed_(true),
|
accessed_(accessed),
|
||||||
pRel_(pRel),
|
pRel_(pRel),
|
||||||
data_(data)
|
data_(data)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -106,6 +106,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
WallCollisionRecord
|
WallCollisionRecord
|
||||||
(
|
(
|
||||||
|
bool accessed,
|
||||||
const vector& pRel,
|
const vector& pRel,
|
||||||
const Type& data = pTraits<Type>::zero
|
const Type& data = pTraits<Type>::zero
|
||||||
);
|
);
|
||||||
|
|||||||
@ -75,6 +75,14 @@ inline bool Foam::WallCollisionRecord<Type>::match
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::vector&
|
||||||
|
Foam::WallCollisionRecord<Type>::pRel() const
|
||||||
|
{
|
||||||
|
return pRel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline const Type&
|
inline const Type&
|
||||||
Foam::WallCollisionRecord<Type>::collisionData() const
|
Foam::WallCollisionRecord<Type>::collisionData() const
|
||||||
|
|||||||
@ -63,8 +63,7 @@ namespace Foam
|
|||||||
|
|
||||||
typedef CollisionRecordList<vector, vector> collisionRecordList;
|
typedef CollisionRecordList<vector, vector> collisionRecordList;
|
||||||
typedef vectorIOFieldField pairDataIOFieldField;
|
typedef vectorIOFieldField pairDataIOFieldField;
|
||||||
|
typedef vectorIOFieldField wallDataIOFieldField;
|
||||||
typedef IOList<collisionRecordList> collisionRecordIOList;
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
class KinematicParcel;
|
class KinematicParcel;
|
||||||
|
|||||||
@ -44,7 +44,13 @@ Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
|
|||||||
+ " rho"
|
+ " rho"
|
||||||
+ " tTurb"
|
+ " tTurb"
|
||||||
+ " (UTurbx UTurby UTurbz)"
|
+ " (UTurbx UTurby UTurbz)"
|
||||||
+ " pairCollisions wallCollisions";
|
+ " collisionRecordsPairAccessed"
|
||||||
|
+ " collisionRecordsPairOrigProcOfOther"
|
||||||
|
+ " collisionRecordsPairOrigIdOfOther"
|
||||||
|
+ " (collisionRecordsPairData)"
|
||||||
|
+ " collisionRecordsWallAccessed"
|
||||||
|
+ " collisionRecordsWallPRel"
|
||||||
|
+ " (collisionRecordsWallData)";
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -168,32 +174,58 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
|
|||||||
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::MUST_READ));
|
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::MUST_READ));
|
||||||
c.checkFieldIOobject(c, UTurb);
|
c.checkFieldIOobject(c, UTurb);
|
||||||
|
|
||||||
collisionRecordIOList collisionRecords
|
labelIOFieldField collisionRecordsPairAccessed
|
||||||
(
|
(
|
||||||
IOobject
|
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
|
||||||
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
|
||||||
|
|
||||||
|
labelIOFieldField collisionRecordsPairOrigProcOfOther
|
||||||
(
|
(
|
||||||
"collisionRecords",
|
c.fieldIOobject
|
||||||
c.time().timeName(),
|
(
|
||||||
c,
|
"collisionRecordsPairOrigProcOfOther",
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
|
||||||
|
|
||||||
if (collisionRecords.size() != c.size())
|
labelIOFieldField collisionRecordsPairOrigIdOfOther
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
(
|
||||||
"void Foam::KinematicParcel<ParcelType>::readFields"
|
c.fieldIOobject
|
||||||
"(Cloud<ParcelType>& c)"
|
(
|
||||||
) << "Size of " << collisionRecords.name()
|
"collisionRecordsPairOrigIdOfOther",
|
||||||
<< " field " << collisionRecords.size()
|
IOobject::MUST_READ
|
||||||
<< " does not match the number of particles " << c.size()
|
)
|
||||||
<< abort(FatalError);
|
);
|
||||||
}
|
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
|
||||||
|
|
||||||
|
pairDataIOFieldField collisionRecordsPairData
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ)
|
||||||
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsPairData);
|
||||||
|
|
||||||
|
labelIOFieldField collisionRecordsWallAccessed
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ)
|
||||||
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
|
||||||
|
|
||||||
|
vectorIOFieldField collisionRecordsWallPRel
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ)
|
||||||
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
|
||||||
|
|
||||||
|
wallDataIOFieldField collisionRecordsWallData
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ)
|
||||||
|
);
|
||||||
|
c.checkFieldFieldIOobject(c, collisionRecordsWallData);
|
||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
|
|
||||||
forAllIter(typename Cloud<ParcelType>, c, iter)
|
forAllIter(typename Cloud<ParcelType>, c, iter)
|
||||||
{
|
{
|
||||||
ParcelType& p = iter();
|
ParcelType& p = iter();
|
||||||
@ -208,7 +240,17 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
|
|||||||
p.rho_ = rho[i];
|
p.rho_ = rho[i];
|
||||||
p.tTurb_ = tTurb[i];
|
p.tTurb_ = tTurb[i];
|
||||||
p.UTurb_ = UTurb[i];
|
p.UTurb_ = UTurb[i];
|
||||||
p.collisionRecords_ = collisionRecords[i];
|
p.collisionRecords_ = collisionRecordList
|
||||||
|
(
|
||||||
|
collisionRecordsPairAccessed[i],
|
||||||
|
collisionRecordsPairOrigProcOfOther[i],
|
||||||
|
collisionRecordsPairOrigIdOfOther[i],
|
||||||
|
collisionRecordsPairData[i],
|
||||||
|
collisionRecordsWallAccessed[i],
|
||||||
|
collisionRecordsWallPRel[i],
|
||||||
|
collisionRecordsWallData[i]
|
||||||
|
);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,23 +283,43 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
IOField<scalar> tTurb(c.fieldIOobject("tTurb", IOobject::NO_READ), np);
|
IOField<scalar> tTurb(c.fieldIOobject("tTurb", IOobject::NO_READ), np);
|
||||||
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::NO_READ), np);
|
IOField<vector> UTurb(c.fieldIOobject("UTurb", IOobject::NO_READ), np);
|
||||||
|
|
||||||
collisionRecordIOList collisionRecords
|
labelIOFieldField collisionRecordsPairAccessed
|
||||||
(
|
(
|
||||||
IOobject
|
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
|
||||||
|
np
|
||||||
|
);
|
||||||
|
labelIOFieldField collisionRecordsPairOrigProcOfOther
|
||||||
(
|
(
|
||||||
"collisionRecords",
|
c.fieldIOobject
|
||||||
c.time().timeName(),
|
(
|
||||||
c,
|
"collisionRecordsPairOrigProcOfOther",
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
np
|
np
|
||||||
);
|
);
|
||||||
|
labelIOFieldField collisionRecordsPairOrigIdOfOther
|
||||||
pairDataIOFieldField collisionRecords_pairData
|
|
||||||
(
|
(
|
||||||
c.fieldIOobject("collisionRecords_pairData", IOobject::NO_READ),
|
c.fieldIOobject("collisionRecordsPairOrigIdOfOther", IOobject::NO_READ),
|
||||||
|
np
|
||||||
|
);
|
||||||
|
pairDataIOFieldField collisionRecordsPairData
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsPairData", IOobject::NO_READ),
|
||||||
|
np
|
||||||
|
);
|
||||||
|
labelIOFieldField collisionRecordsWallAccessed
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::NO_READ),
|
||||||
|
np
|
||||||
|
);
|
||||||
|
vectorIOFieldField collisionRecordsWallPRel
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallPRel", IOobject::NO_READ),
|
||||||
|
np
|
||||||
|
);
|
||||||
|
wallDataIOFieldField collisionRecordsWallData
|
||||||
|
(
|
||||||
|
c.fieldIOobject("collisionRecordsWallData", IOobject::NO_READ),
|
||||||
np
|
np
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -278,19 +340,15 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
rho[i] = p.rho();
|
rho[i] = p.rho();
|
||||||
tTurb[i] = p.tTurb();
|
tTurb[i] = p.tTurb();
|
||||||
UTurb[i] = p.UTurb();
|
UTurb[i] = p.UTurb();
|
||||||
collisionRecords[i] = p.collisionRecords();
|
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
|
||||||
collisionRecords_pairData[i] = p.collisionRecords().pairData();
|
collisionRecordsPairOrigProcOfOther[i] =
|
||||||
|
p.collisionRecords().pairOrigProcOfOther();
|
||||||
// collisionRecords_pairData[i].setSize
|
collisionRecordsPairOrigIdOfOther[i] =
|
||||||
// (
|
p.collisionRecords().pairOrigIdOfOther();
|
||||||
// p.collisionRecords().pairRecords().size()
|
collisionRecordsPairData[i] = p.collisionRecords().pairData();
|
||||||
// );
|
collisionRecordsWallAccessed[i] = p.collisionRecords().wallAccessed();
|
||||||
|
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
|
||||||
// forAll(p.collisionRecords().pairRecords(), j)
|
collisionRecordsWallData[i] = p.collisionRecords().wallData();
|
||||||
// {
|
|
||||||
// collisionRecords_pairData[i][j] =
|
|
||||||
// p.collisionRecords().pairRecords()[j].collisionData();
|
|
||||||
// }
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -306,8 +364,13 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
rho.write();
|
rho.write();
|
||||||
tTurb.write();
|
tTurb.write();
|
||||||
UTurb.write();
|
UTurb.write();
|
||||||
collisionRecords.write();
|
collisionRecordsPairAccessed.write();
|
||||||
collisionRecords_pairData.write();
|
collisionRecordsPairOrigProcOfOther.write();
|
||||||
|
collisionRecordsPairOrigIdOfOther.write();
|
||||||
|
collisionRecordsPairData.write();
|
||||||
|
collisionRecordsWallAccessed.write();
|
||||||
|
collisionRecordsWallPRel.write();
|
||||||
|
collisionRecordsWallData.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,13 +34,6 @@ namespace Foam
|
|||||||
defineTemplateTypeNameAndDebug(Cloud<basicKinematicParcel>, 0);
|
defineTemplateTypeNameAndDebug(Cloud<basicKinematicParcel>, 0);
|
||||||
|
|
||||||
defineParcelTypeNameAndDebug(KinematicCloud<basicKinematicParcel>, 0);
|
defineParcelTypeNameAndDebug(KinematicCloud<basicKinematicParcel>, 0);
|
||||||
|
|
||||||
defineTemplateTypeNameAndDebugWithName
|
|
||||||
(
|
|
||||||
collisionRecordIOList,
|
|
||||||
"collisionRecordList",
|
|
||||||
0
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::IOFieldField<Field<Type>, Type> >
|
Foam::tmp<Foam::IOFieldField<Foam::Field<Type>, Type> >
|
||||||
Foam::reconstructLagrangianFieldField
|
Foam::reconstructLagrangianFieldField
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
|
|||||||
Reference in New Issue
Block a user