mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
adding -fields option
This commit is contained in:
@ -151,18 +151,20 @@ public:
|
|||||||
const IOobject& fieldIoObject
|
const IOobject& fieldIoObject
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Reconstruct and write all volume fields
|
//- Reconstruct and write all/selected volume fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void reconstructFvVolumeFields
|
void reconstructFvVolumeFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects
|
const IOobjectList& objects,
|
||||||
|
const HashSet<word>& selectedFields
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Reconstruct and write all volume fields
|
//- Reconstruct and write all/selected volume fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void reconstructFvSurfaceFields
|
void reconstructFvSurfaceFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects
|
const IOobjectList& objects,
|
||||||
|
const HashSet<word>& selectedFields
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
forAll(cp, faceI)
|
forAll(cp, faceI)
|
||||||
{
|
{
|
||||||
// Subtract one to take into account offsets for
|
// Subtract one to take into account offsets for
|
||||||
// face direction.
|
// face direction.
|
||||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
forAll(cp, faceI)
|
forAll(cp, faceI)
|
||||||
{
|
{
|
||||||
// Subtract one to take into account offsets for
|
// Subtract one to take into account offsets for
|
||||||
// face direction.
|
// face direction.
|
||||||
label curF = cp[faceI] - 1;
|
label curF = cp[faceI] - 1;
|
||||||
|
|
||||||
// Is the face on the boundary?
|
// Is the face on the boundary?
|
||||||
@ -282,7 +282,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
|
|
||||||
// It is necessary to create a copy of the addressing array to
|
// It is necessary to create a copy of the addressing array to
|
||||||
// take care of the face direction offset trick.
|
// take care of the face direction offset trick.
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
labelList curAddr(faceProcAddressing_[procI]);
|
labelList curAddr(faceProcAddressing_[procI]);
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
forAll(cp, faceI)
|
forAll(cp, faceI)
|
||||||
{
|
{
|
||||||
// Subtract one to take into account offsets for
|
// Subtract one to take into account offsets for
|
||||||
// face direction.
|
// face direction.
|
||||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,11 +452,12 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reconstruct and write all volume fields
|
// Reconstruct and write all/selected volume fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects
|
const IOobjectList& objects,
|
||||||
|
const HashSet<word>& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& fieldClassName =
|
||||||
@ -468,27 +469,29 @@ void Foam::fvFieldReconstructor::reconstructFvVolumeFields
|
|||||||
{
|
{
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||||
|
|
||||||
for
|
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||||
(
|
|
||||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
|
||||||
fieldIter != fields.end();
|
|
||||||
++fieldIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
if
|
||||||
|
(
|
||||||
|
!selectedFields.size()
|
||||||
|
|| selectedFields.found(fieldIter()->name())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldIter()->name() << endl;
|
||||||
|
|
||||||
reconstructFvVolumeField<Type>(*fieldIter())().write();
|
reconstructFvVolumeField<Type>(*fieldIter())().write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconstruct and write all surface fields
|
// Reconstruct and write all/selected surface fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects
|
const IOobjectList& objects,
|
||||||
|
const HashSet<word>& selectedFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldClassName =
|
const word& fieldClassName =
|
||||||
@ -500,18 +503,19 @@ void Foam::fvFieldReconstructor::reconstructFvSurfaceFields
|
|||||||
{
|
{
|
||||||
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
|
||||||
|
|
||||||
for
|
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||||
(
|
|
||||||
IOobjectList::const_iterator fieldIter = fields.begin();
|
|
||||||
fieldIter != fields.end();
|
|
||||||
++fieldIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Info<< " " << fieldIter()->name() << endl;
|
if
|
||||||
|
(
|
||||||
|
!selectedFields.size()
|
||||||
|
|| selectedFields.found(fieldIter()->name())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldIter()->name() << endl;
|
||||||
|
|
||||||
reconstructFvSurfaceField<Type>(*fieldIter())().write();
|
reconstructFvSurfaceField<Type>(*fieldIter())().write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,9 +48,17 @@ int main(int argc, char *argv[])
|
|||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
timeSelector::addOptions();
|
timeSelector::addOptions();
|
||||||
# include "addRegionOption.H"
|
# include "addRegionOption.H"
|
||||||
|
argList::validOptions.insert("fields", "\"(list of fields)\"");
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
HashSet<word> selectedFields;
|
||||||
|
if (args.options().found("fields"))
|
||||||
|
{
|
||||||
|
IStringStream(args.options()["fields"])() >> selectedFields;
|
||||||
|
}
|
||||||
|
|
||||||
// determine the processor count directly
|
// determine the processor count directly
|
||||||
label nProcs = 0;
|
label nProcs = 0;
|
||||||
while (dir(args.path()/(word("processor") + name(nProcs))))
|
while (dir(args.path()/(word("processor") + name(nProcs))))
|
||||||
@ -184,13 +192,37 @@ int main(int argc, char *argv[])
|
|||||||
procMeshes.boundaryProcAddressing()
|
procMeshes.boundaryProcAddressing()
|
||||||
);
|
);
|
||||||
|
|
||||||
fvReconstructor.reconstructFvVolumeFields<scalar>(objects);
|
fvReconstructor.reconstructFvVolumeFields<scalar>
|
||||||
fvReconstructor.reconstructFvVolumeFields<vector>(objects);
|
(
|
||||||
fvReconstructor.reconstructFvVolumeFields<sphericalTensor>(objects);
|
objects,
|
||||||
fvReconstructor.reconstructFvVolumeFields<symmTensor>(objects);
|
selectedFields
|
||||||
fvReconstructor.reconstructFvVolumeFields<tensor>(objects);
|
);
|
||||||
|
fvReconstructor.reconstructFvVolumeFields<vector>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
selectedFields
|
||||||
|
);
|
||||||
|
fvReconstructor.reconstructFvVolumeFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
selectedFields
|
||||||
|
);
|
||||||
|
fvReconstructor.reconstructFvVolumeFields<symmTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
selectedFields
|
||||||
|
);
|
||||||
|
fvReconstructor.reconstructFvVolumeFields<tensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
selectedFields
|
||||||
|
);
|
||||||
|
|
||||||
fvReconstructor.reconstructFvSurfaceFields<scalar>(objects);
|
fvReconstructor.reconstructFvSurfaceFields<scalar>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
selectedFields
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user