Commit 0c2b4c25 authored by Henry's avatar Henry
Browse files

Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C
parents 884a6352 537a916d
......@@ -541,29 +541,51 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName());
HashSet<word> selectedFields;
args.optionReadIfPresent("fields", selectedFields);
bool specifiedFields = args.optionReadIfPresent
(
"fields",
selectedFields
);
// Construct the vol fields (on the original mesh if subsetted)
PtrList<volScalarField> vsf;
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf);
print(" volScalarFields :", Info, vsf);
PtrList<volVectorField> vvf;
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf);
print(" volVectorFields :", Info, vvf);
PtrList<volSphericalTensorField> vSpheretf;
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSpheretf);
print(" volSphericalTensorFields :", Info, vSpheretf);
PtrList<volSymmTensorField> vSymmtf;
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSymmtf);
print(" volSymmTensorFields :", Info, vSymmtf);
PtrList<volTensorField> vtf;
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf);
print(" volTensorFields :", Info, vtf);
if (!specifiedFields || selectedFields.size())
{
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf);
print(" volScalarFields :", Info, vsf);
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf);
print(" volVectorFields :", Info, vvf);
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
vSpheretf
);
print(" volSphericalTensorFields :", Info, vSpheretf);
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
vSymmtf
);
print(" volSymmTensorFields :", Info, vSymmtf);
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf);
print(" volTensorFields :", Info, vtf);
}
label nVolFields =
vsf.size()
......@@ -589,7 +611,7 @@ int main(int argc, char *argv[])
PtrList<pointSymmTensorField> pSymmtf;
PtrList<pointTensorField> ptf;
if (!noPointValues)
if (!noPointValues && !(specifiedFields && selectedFields.empty()))
{
readFields
(
......
......@@ -263,6 +263,26 @@ checkLineLengthNonDirective()
}
#
# check that OpenCFD copyright is currents
#
checkCopyright()
{
year=$(date +%Y)
echo "$hookName: check copyright ..." 1>&2
for f in $fileList
do
sYear=`grep "Copyright.*OpenCFD" $f | sed 's/[^0-9]//g' | cut -c 5-9`
if [ "$year" != "" ] && [ "$year" != "$sYear" ]; then
echo "Updated copyright for: $f"
sed -i "s/$sYear OpenCFD/$year OpenCFD/g" $f
fi
done
}
#------------------------------------------------------------------------------
# Main code : do all checks
#
......@@ -276,6 +296,7 @@ checkIllegalCode
# ensure code conforms to 80 columns max
checkLineLengthNonDirective
checkCopyright
exit 0
#------------------------------------------------------------------------------
......@@ -66,8 +66,13 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
// Master reads headerclassname from file. Make sure this gets
// transfered as well as contents.
Pstream::scatter(comms, const_cast<word&>(headerClassName()));
Pstream::scatter(comms, note());
Pstream::scatter
(
comms,
const_cast<word&>(headerClassName()),
Pstream::msgType()
);
Pstream::scatter(comms, note(), Pstream::msgType());
// Get my communication order
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
......@@ -88,6 +93,7 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
Pstream::scheduled,
myComm.above(),
0,
Pstream::msgType(),
IOstream::ASCII
);
IOdictionary::readData(fromAbove);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -32,6 +32,7 @@ Foam::IPstream::IPstream
const commsTypes commsType,
const int fromProcNo,
const label bufSize,
const int tag,
streamFormat format,
versionNumber version
)
......@@ -43,7 +44,7 @@ Foam::IPstream::IPstream
fromProcNo,
buf_,
externalBufPosition_,
UPstream::msgType(), // tag
tag, // tag
false, // do not clear buf_ if at end
format,
version
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -68,6 +68,7 @@ public:
const commsTypes commsType,
const int fromProcNo,
const label bufSize = 0,
const int tag = UPstream::msgType(),
streamFormat format=BINARY,
versionNumber version=currentVersion
);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -97,20 +97,31 @@ public:
(
const List<commsStruct>& comms,
T& Value,
const BinaryOp& bop
const BinaryOp& bop,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T, class BinaryOp>
static void gather(T& Value, const BinaryOp& bop);
static void gather
(
T& Value,
const BinaryOp& bop,
const int tag = Pstream::msgType()
);
//- Scatter data. Distribute without modification. Reverse of gather
template <class T>
static void scatter(const List<commsStruct>& comms, T& Value);
static void scatter
(
const List<commsStruct>& comms,
T& Value,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T>
static void scatter(T& Value);
static void scatter(T& Value, const int tag = Pstream::msgType());
// Combine variants. Inplace combine values from processors.
......@@ -121,24 +132,35 @@ public:
(
const List<commsStruct>& comms,
T& Value,
const CombineOp& cop
const CombineOp& cop,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T, class CombineOp>
static void combineGather(T& Value, const CombineOp& cop);
static void combineGather
(
T& Value,
const CombineOp& cop,
const int tag = Pstream::msgType()
);
//- Scatter data. Reverse of combineGather
template <class T>
static void combineScatter
(
const List<commsStruct>& comms,
T& Value
T& Value,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T>
static void combineScatter(T& Value);
static void combineScatter
(
T& Value,
const int tag = Pstream::msgType()
);
// Combine variants working on whole List at a time.
......@@ -147,24 +169,35 @@ public:
(
const List<commsStruct>& comms,
List<T>& Value,
const CombineOp& cop
const CombineOp& cop,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T, class CombineOp>
static void listCombineGather(List<T>& Value, const CombineOp& cop);
static void listCombineGather
(
List<T>& Value,
const CombineOp& cop,
const int tag = Pstream::msgType()
);
//- Scatter data. Reverse of combineGather
template <class T>
static void listCombineScatter
(
const List<commsStruct>& comms,
List<T>& Value
List<T>& Value,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T>
static void listCombineScatter(List<T>& Value);
static void listCombineScatter
(
List<T>& Value,
const int tag = Pstream::msgType()
);
// Combine variants working on whole map at a time. Container needs to
// have iterators and find() defined.
......@@ -174,7 +207,8 @@ public:
(
const List<commsStruct>& comms,
Container& Values,
const CombineOp& cop
const CombineOp& cop,
const int tag
);
//- Like above but switches between linear/tree communication
......@@ -182,7 +216,8 @@ public:
static void mapCombineGather
(
Container& Values,
const CombineOp& cop
const CombineOp& cop,
const int tag = Pstream::msgType()
);
//- Scatter data. Reverse of combineGather
......@@ -190,12 +225,17 @@ public:
static void mapCombineScatter
(
const List<commsStruct>& comms,
Container& Values
Container& Values,
const int tag
);
//- Like above but switches between linear/tree communication
template <class Container>
static void mapCombineScatter(Container& Values);
static void mapCombineScatter
(
Container& Values,
const int tag = Pstream::msgType()
);
......@@ -208,24 +248,34 @@ public:
static void gatherList
(
const List<commsStruct>& comms,
List<T>& Values
List<T>& Values,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T>
static void gatherList(List<T>& Values);
static void gatherList
(
List<T>& Values,
const int tag = Pstream::msgType()
);
//- Scatter data. Reverse of gatherList
template <class T>
static void scatterList
(
const List<commsStruct>& comms,
List<T>& Values
List<T>& Values,
const int tag
);
//- Like above but switches between linear/tree communication
template <class T>
static void scatterList(List<T>& Values);
static void scatterList
(
List<T>& Values,
const int tag = Pstream::msgType()
);
// Exchange
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -137,6 +137,11 @@ public:
// Member functions
int tag() const
{
return tag_;
}
//- Mark all sends as having been done. This will start receives
// in non-blocking mode. If block will wait for all transfers to
// finish (only relevant for nonBlocking mode)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -52,26 +52,38 @@ void combineReduce
(
const List<UPstream::commsStruct>& comms,
T& Value,
const CombineOp& cop
const CombineOp& cop,
const int tag
)
{
Pstream::combineGather(comms, Value, cop);
Pstream::combineScatter(comms, Value);
Pstream::combineGather(comms, Value, cop, tag);
Pstream::combineScatter(comms, Value, tag);
}
template <class T, class CombineOp>
void combineReduce(T& Value, const CombineOp& cop)
void combineReduce
(
T& Value,
const CombineOp& cop,
const int tag = Pstream::msgType()
)
{
if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
{
Pstream::combineGather(UPstream::linearCommunication(), Value, cop);
Pstream::combineScatter(UPstream::linearCommunication(), Value);
Pstream::combineGather
(
UPstream::linearCommunication(),
Value,
cop,
tag
);
Pstream::combineScatter(UPstream::linearCommunication(), Value, tag);
}
else
{
Pstream::combineGather(UPstream::treeCommunication(), Value, cop);
Pstream::combineScatter(UPstream::treeCommunication(), Value);
Pstream::combineGather(UPstream::treeCommunication(), Value, cop, tag);
Pstream::combineScatter(UPstream::treeCommunication(), Value, tag);
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -42,11 +42,12 @@ void reduce
(
const List<UPstream::commsStruct>& comms,
T& Value,
const BinaryOp& bop
const BinaryOp& bop,
const int tag
)
{
Pstream::gather(comms, Value, bop);
Pstream::scatter(comms, Value);
Pstream::gather(comms, Value, bop, tag);
Pstream::scatter(comms, Value, tag);
}
......@@ -55,16 +56,17 @@ template <class T, class BinaryOp>
void reduce
(
T& Value,
const BinaryOp& bop
const BinaryOp& bop,
const int tag = Pstream::msgType()
)
{
if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
{
reduce(UPstream::linearCommunication(), Value, bop);
reduce(UPstream::linearCommunication(), Value, bop, tag);
}
else
{
reduce(UPstream::treeCommunication(), Value, bop);
reduce(UPstream::treeCommunication(), Value, bop, tag);
}
}
......@@ -74,18 +76,19 @@ template <class T, class BinaryOp>
T returnReduce
(
const T& Value,
const BinaryOp& bop
const BinaryOp& bop,
const int tag = Pstream::msgType()
)
{
T WorkValue(Value);
if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
{
reduce(UPstream::linearCommunication(), WorkValue, bop);
reduce(UPstream::linearCommunication(), WorkValue, bop, tag);
}
else
{
reduce(UPstream::treeCommunication(), WorkValue, bop);
reduce(UPstream::treeCommunication(), WorkValue, bop, tag);
}
return WorkValue;
......@@ -93,7 +96,12 @@ T returnReduce
// Insist there is a specialisation for the reduction of a scalar
void reduce(scalar& Value, const sumOp<scalar>& bop);
void reduce
(
scalar& Value,
const sumOp<scalar>& bop,
const int tag = Pstream::msgType()
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -84,13 +84,17 @@ Foam::UIPstream::~UIPstream()
{
if (debug)
{
Pout<< "UIPstream::~UIPstream() : clearing externalBuf_ of size "
<< externalBuf_.size() << endl;
Pout<< "UIPstream::~UIPstream() : tag:" << tag_
<< " fromProcNo:" << fromProcNo_
<< " clearing externalBuf_ of size "
<< externalBuf_.size()
<< " messageSize_:" << messageSize_ << endl;
}
externalBuf_.clearStorage();
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Istream& Foam::UIPstream::read(token& t)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -262,14 +262,23 @@ public:
// Spawns slave processes and initialises inter-communication
static bool init(int& argc, char**& argv);
//- Non-blocking comms: wait until all have finished.
static void waitRequests();
// Non-blocking comms
//- Get number of outstanding requests
static label nRequests();
//- Truncate number of outstanding requests
static void resetRequests(const label sz);
//- Wait until all requests (from start onwards) have finished.
static void waitRequests(const label start = 0);
//- Non-blocking comms: has request i finished?
static bool finishedRequest(const label i);
//- Non-blocking comms: has request i finished?
static bool finishedRequest(const label i);
//- Is this a parallel run?
static bool parRun()
static bool& parRun()
{
return parRun_;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -50,7 +50,8 @@ void Pstream::combineGather
(
const List<UPstream::commsStruct>& comms,