Commit ccc9ae67 authored by Henry's avatar Henry
Browse files
parents 03f0092c 3c2f7a0c
......@@ -91,6 +91,9 @@
*** *New* ptscotch decomposition method
*** *Updated* particle tracking algorithm
*** *Updated* split cyclics into two separate patches. See doc/changed/splitCyclics.txt
* *Updated* interpolation (volPointInterpolation) now works without the
globalPointPatch. Moving mesh cases can now be run non-parallel and
continued in parallel and reconstructed without any limitation.
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
*** *Updated* runTimeModifiable
+ on linux uses inotify instead of time stamps - more efficient for large
......
......@@ -37,18 +37,16 @@ Foam::scalar Foam::solidRegionDiffNo
scalar DiNum = 0.0;
scalar meanDiNum = 0.0;
//- Can have fluid domains with 0 cells so do not test.
if (mesh.nInternalFaces())
{
surfaceScalarField KrhoCpbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(K)
/ fvc::interpolate(Cprho);
DiNum = max(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
}
//- Take care: can have fluid domains with 0 cells so do not test for
// zero internal faces.
surfaceScalarField KrhoCpbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(K)
/ fvc::interpolate(Cprho);
DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
<< " max: " << DiNum << endl;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -25,9 +25,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "point.H"
#include "DynamicField.H"
#include "IOstreams.H"
#include "labelField.H"
using namespace Foam;
......@@ -36,44 +36,62 @@ using namespace Foam;
int main(int argc, char *argv[])
{
{
DynamicField<label> dl(10);
Pout<< "null construct dl:" << dl << endl;
dl.append(3);
dl.append(2);
dl.append(1);
Pout<< "appending : dl:" << dl << endl;
dl[2] *= 10;
Pout<< "assigning : dl:" << dl << endl;
}
{
DynamicField<label> dl(IStringStream("(1 2 3)")());
Pout<< "reading : dl:" << dl << endl;
}
{
labelField lf(3);
lf[0] = 1;
lf[1] = 2;
lf[2] = 3;
DynamicField<label> dl;
dl = lf;
Pout<< "assigning from labelField : dl:" << dl << endl;
}
{
labelField lf(3);
lf[0] = 1;
lf[1] = 2;
lf[2] = 3;
DynamicField<label> dl(lf);
Pout<< "constructing from labelField dl:" << dl << endl;
}
Info<< "\nEnd\n";
DynamicField<point, 0, 10, 11> testField;
DynamicField<point, 0, 10, 11> testField2;
testField.setSize(5);
testField2.setSize(5);
testField[0] = testField2[0] = vector(1.0, 4.5, 6.3);
testField[1] = testField2[1] = vector(5.2, 2.3, 3.5);
testField[2] = testField2[2] = vector(7.5, 4.7, 7.7);
testField[3] = testField2[3] = vector(2.8, 8.2, 2.3);
testField[4] = testField2[4] = vector(6.1, 1.7, 8.8);
Info << "testField:" << testField << endl;
testField.append(vector(0.5, 4.8, 6.2));
Info << "testField after appending:" << testField << endl;
testField.append(vector(2.7, 2.3, 6.1));
Info << "testField after appending:" << testField << endl;
vector elem = testField.remove();
Info << "removed element:" << elem << endl;
Info << "testField:" << testField << endl;
testField.append(vector(3.0, 1.3, 9.2));
Info << "testField:" << testField << endl;
testField.setSize(10, vector(1.5, 0.6, -1.0));
Info << "testField after setSize:" << testField << endl;
testField.append(testField2);
Info << "testField after appending testField2:" << testField << endl;
testField = testField2;
Info << "testField after assignment:" << testField << endl;
testField += testField2;
Info << "testField after field algebra:" << testField << endl;
testField.clear();
testField.append(vector(3.0, 1.3, 9.2));
Info << "testField after clear and append:" << testField << endl;
testField.clearStorage();
Info << "testField after clearStorage:" << testField << endl;
return 0;
}
......
......@@ -162,12 +162,14 @@ do
procCmdFile="$PWD/processor${proc}.sh"
procLog="processor${proc}.log"
geom="-geometry 120x20+$xpos+$ypos"
node=""
if [ "$WM_MPLIB" = OPENMPI ]
then
case "$WM_MPLIB" in
*OPENMPI)
node="-np 1 "
fi
;;
*)
node=""
esac
echo "#!/bin/sh" > $procCmdFile
case "$method" in
......
......@@ -28,8 +28,8 @@ License
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList()
:
List<T>(SizeInc),
capacity_(SizeInc)
List<T>(0),
capacity_(0)
{
List<T>::size(0);
}
......
......@@ -25,87 +25,53 @@ License
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
template<class Type>
const char* const DynamicField<Type>::typeName("DynamicField");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
DynamicField<Type>::DynamicField(Istream& is)
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::DynamicField(Istream& is)
:
Field<Type>(is),
capacity_(Field<Type>::size())
Field<T>(is),
capacity_(Field<T>::size())
{}
template<class Type>
tmp<DynamicField<Type> > DynamicField<Type>::clone() const
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Foam::tmp<Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv> >
Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::clone() const
{
return tmp<DynamicField<Type> >(new DynamicField<Type>(*this));
return tmp<DynamicField<T, SizeInc, SizeMult, SizeDiv> >
(
new DynamicField<T, SizeInc, SizeMult, SizeDiv>(*this)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void DynamicField<Type>::setSize(const label nElem)
{
// allocate more capacity?
if (nElem > capacity_)
{
capacity_ = max(nElem, label(1 + capacity_*2));
Field<Type>::setSize(capacity_);
}
// adjust addressed size
Field<Type>::size(nElem);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * //
template<class Type>
Ostream& operator<<(Ostream& os, const DynamicField<Type>& f)
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const DynamicField<T, SizeInc, SizeMult, SizeDiv>& lst
)
{
os << static_cast<const Field<Type>&>(f);
os << static_cast<const Field<T>&>(lst);
return os;
}
template<class Type>
Ostream& operator<<(Ostream& os, const tmp<DynamicField<Type> >& tf)
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Foam::Istream& Foam::operator>>
(
Istream& is,
DynamicField<T, SizeInc, SizeMult, SizeDiv>& lst
)
{
os << tf();
tf.clear();
return os;
}
template<class Type>
Istream& operator>>(Istream& is, DynamicField<Type>& lst)
{
is >> static_cast<Field<Type>&>(lst);
lst.capacity_ = lst.Field<Type>::size();
is >> static_cast<Field<T>&>(lst);
lst.capacity_ = lst.Field<T>::size();
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -25,9 +25,10 @@ Class
Foam::DynamicField
Description
Dynamically sized Field. WIP.
Dynamically sized Field.
SourceFiles
DynamicFieldI.H
DynamicField.C
\*---------------------------------------------------------------------------*/
......@@ -44,89 +45,78 @@ namespace Foam
// Forward declaration of friend functions and operators
template<class Type>
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
class DynamicField;
template<class Type>
Ostream& operator<<(Ostream&, const DynamicField<Type>&);
template<class Type>
Ostream& operator<<(Ostream&, const tmp<DynamicField<Type> >&);
template<class Type>
Istream& operator>>(Istream&, DynamicField<Type>&);
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Ostream& operator<<
(
Ostream&,
const DynamicField<T, SizeInc, SizeMult, SizeDiv>&
);
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Istream& operator>>
(
Istream&,
DynamicField<T, SizeInc, SizeMult, SizeDiv>&
);
/*---------------------------------------------------------------------------*\
Class DynamicField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
template<class T, unsigned SizeInc=0, unsigned SizeMult=2, unsigned SizeDiv=1>
class DynamicField
:
public Field<Type>
public Field<T>
{
// Private data
//- The capacity (allocated size) of the underlying field.
label capacity_;
//- Construct given size and initial value
DynamicField(const label, const Type&);
//- Construct as copy of tmp<DynamicField>
# ifdef ConstructFromTmp
DynamicField(const tmp<DynamicField<Type> >&);
# endif
//- Construct from a dictionary entry
DynamicField(const word&, const dictionary&, const label);
public:
// Static data members
static const char* const typeName;
// Static Member Functions
//- Return a null field
inline static const DynamicField<Type>& null()
inline static const DynamicField<T, SizeInc, SizeMult, SizeDiv>& null()
{
return *reinterpret_cast< DynamicField<Type>* >(0);
return *reinterpret_cast
<
DynamicField<T, SizeInc, SizeMult, SizeDiv>*
>(0);
}
// Constructors
//- Construct null
// Used for temporary fields which are initialised after construction
DynamicField();
inline DynamicField();
//- Construct given size
// Used for temporary fields which are initialised after construction
//- Construct given size.
explicit inline DynamicField(const label);
//- Construct as copy of a UList\<Type\>
explicit inline DynamicField(const UList<Type>&);
//- Construct from UList. Size set to UList size.
// Also constructs from DynamicField with different sizing parameters.
explicit inline DynamicField(const UList<T>&);
//- Construct by transferring the List contents
explicit inline DynamicField(const Xfer<List<Type> >&);
//- Construct by transferring the parameter contents
explicit inline DynamicField(const Xfer<List<T> >&);
//- Construct by 1 to 1 mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const UList<T>& mapF,
const labelList& mapAddressing
);
//- Construct by interpolative mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const UList<T>& mapF,
const labelListList& mapAddressing,
const scalarListList& weights
);
......@@ -134,59 +124,129 @@ public:
//- Construct by mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const UList<T>& mapF,
const FieldMapper& map
);
//- Construct as copy
inline DynamicField(const DynamicField<Type>&);
//- Construct as copy or re-use as specified.
inline DynamicField(DynamicField<Type>&, bool reUse);
//- Construct copy
inline DynamicField(const DynamicField<T, SizeInc, SizeMult, SizeDiv>&);
//- Construct by transferring the Field contents
inline DynamicField(const Xfer<DynamicField<Type> >&);
inline DynamicField
(
const Xfer<DynamicField<T, SizeInc, SizeMult, SizeDiv> >&
);
//- Construct from Istream
inline DynamicField(Istream&);
//- Construct from Istream. Size set to size of list read.
explicit DynamicField(Istream&);
//- Clone
tmp<DynamicField<Type> > clone() const;
tmp<DynamicField<T, SizeInc, SizeMult, SizeDiv> > clone() const;
// Member Functions
//- Size of the underlying storage.
inline label capacity() const;
// Access
//- Size of the underlying storage.
inline label capacity() const;
// Edit
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
// Use this or reserve() in combination with append().
inline void setCapacity(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void setSize(const label);
//- Alter the addressed list size and fill new space with a
// constant.
inline void setSize(const label, const T&);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void resize(const label);
//- Alter the addressed list size and fill new space with a
// constant.
inline void resize(const label, const T&);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label);
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline void clear();
//- Clear the list and delete storage.
inline void clearStorage();
//- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicField.
inline DynamicField<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list
inline DynamicField<T, SizeInc, SizeMult, SizeDiv>& append
(
const T&
);
//- Append a List at the end of this list
inline DynamicField<T, SizeInc, SizeMult, SizeDiv>& append
(
const UList<T>&
);
//- Append an element at the end of the list
inline void append(const Type&);
//- Remove and return the top element
inline T remove();
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
void setSize(const label nElem);
//- Return non-const access to an element, resizing list if
// necessary
inline T& operator()(const label);
// Member operators
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
inline void operator=(const DynamicField<Type>&);
inline void operator=(const UList<Type>&);
inline void operator=(const tmp<DynamicField<Type> >&);
//- Assignment from DynamicField
inline void operator=
(
const DynamicField<T, SizeInc, SizeMult, SizeDiv>&
);
//- Return element of Field.
using Field<Type>::operator[];
//- Assignment from UList
inline void operator=(const UList<T>&);
// IOstream operators
friend Ostream& operator<< <Type>
(Ostream&, const DynamicField<Type>&);
// IOstream operators
friend Ostream& operator<< <Type>
(Ostream&, const tmp<DynamicField<Type> >&);
// Write DynamicField to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicField<T, SizeInc, SizeMult, SizeDiv>&
);
friend Istream& operator>> <Type>
(Istream&, DynamicField<Type>&);
//- Read from Istream, discarding contents of existing DynamicField.