Commit c100ffc9 authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge commit 'OpenCFD/master' into olesenm

Conflicts:
	src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C
	src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H
	src/mesh/blockMesh/curvedEdges/BSpline.C
	src/mesh/blockMesh/curvedEdges/spline.C
	src/mesh/blockMesh/curvedEdges/spline.H

- Also adjusted chemistrySolver/EulerImplicit/EulerImplicit.C
  to use simpleMatrix with initialized values
parents b7cf30bd 278e8c50
......@@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "simpleMatrix.H"
#include "vector.H"
#include "IFstream.H"
#include "BSpline.H"
......
......@@ -94,7 +94,8 @@ int main(int argc, char *argv[])
noFailedChecks += checkGeometry(mesh, allGeometry);
reduce(noFailedChecks, sumOp<label>());
// Note: no reduction in noFailedChecks necessary since is
// counter of checks, not counter of failed cells,faces etc.
if (noFailedChecks == 0)
{
......@@ -112,8 +113,6 @@ int main(int argc, char *argv[])
label nFailedChecks = checkGeometry(mesh, allGeometry);
reduce(nFailedChecks, sumOp<label>());
if (nFailedChecks)
{
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
......
......@@ -220,7 +220,7 @@ void Foam::writeFuns::writePointDataHeader
}
void Foam::writeFuns::insert(const scalar& pt, DynamicList<floatScalar>& dest)
void Foam::writeFuns::insert(const scalar pt, DynamicList<floatScalar>& dest)
{
dest.append(float(pt));
}
......
......@@ -86,7 +86,7 @@ public:
// Convert to VTK and store
static void insert(const scalar&, DynamicList<floatScalar>&);
static void insert(const scalar, DynamicList<floatScalar>&);
static void insert(const point&, DynamicList<floatScalar>&);
static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
static void insert(const symmTensor&, DynamicList<floatScalar>&);
......
......@@ -42,7 +42,7 @@ Foam::scalarRange::scalarRange()
{}
Foam::scalarRange::scalarRange(const scalar& lower, const scalar& upper)
Foam::scalarRange::scalarRange(const scalar lower, const scalar upper)
:
type_(RANGE),
value_(lower),
......@@ -123,7 +123,7 @@ Foam::scalar Foam::scalarRange::upper() const
}
bool Foam::scalarRange::selected(const scalar& value) const
bool Foam::scalarRange::selected(const scalar value) const
{
switch (type_)
{
......
......@@ -92,7 +92,7 @@ public:
scalarRange();
//- Construct a Range
scalarRange(const scalar& lower, const scalar& upper);
scalarRange(const scalar lower, const scalar upper);
//- Construct from Istream.
// Since commas can be used as list delimiters,
......@@ -119,7 +119,7 @@ public:
scalar upper() const;
//- Return true if the value is within the range
bool selected(const scalar&) const;
bool selected(const scalar) const;
// Member Operators
......
......@@ -57,7 +57,7 @@ Foam::scalarRanges::scalarRanges(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::scalarRanges::selected(const scalar& value) const
bool Foam::scalarRanges::selected(const scalar value) const
{
forAll(*this, i)
{
......
......@@ -66,7 +66,7 @@ public:
// Member Functions
//- Return true if the given value is within the ranges
bool selected(const scalar&) const;
bool selected(const scalar) const;
//- Return the set of selected entries in the given list
// that are within the ranges
......
......@@ -43,13 +43,13 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Conversion from degrees to radians
inline scalar degToRad(const scalar& deg)
inline scalar degToRad(const scalar deg)
{
return (deg * constant::mathematical::pi/180.0);
}
//- Conversion from radians to degrees
inline scalar radToDeg(const scalar& rad)
inline scalar radToDeg(const scalar rad)
{
return (rad * 180.0/constant::mathematical::pi);
}
......
......@@ -31,16 +31,21 @@ License
template<class Type>
Foam::simpleMatrix<Type>::simpleMatrix(const label mSize)
:
scalarSquareMatrix(mSize, mSize, pTraits<scalar>::zero),
source_(mSize, pTraits<Type>::zero)
scalarSquareMatrix(mSize),
source_(mSize)
{}
template<class Type>
Foam::simpleMatrix<Type>::simpleMatrix(const label mSize, const scalar& t)
Foam::simpleMatrix<Type>::simpleMatrix
(
const label mSize,
const scalar coeffVal,
const Type& sourceVal
)
:
scalarSquareMatrix(mSize, mSize, t),
source_(mSize, pTraits<Type>::zero)
scalarSquareMatrix(mSize, mSize, coeffVal),
source_(mSize, sourceVal)
{}
......
......@@ -74,11 +74,12 @@ public:
// Constructors
//- Construct given size, initializing matrix coefficients to zero
//- Construct given size
// Note: this does not initialise the coefficients or the source.
simpleMatrix(const label);
//- Construct given size, and initial value for matrix coefficients
simpleMatrix(const label, const scalar&);
//- Construct given size and initial values for coefficients and source
simpleMatrix(const label, const scalar, const Type&);
//- Construct from components
simpleMatrix(const scalarSquareMatrix&, const Field<Type>&);
......
......@@ -60,6 +60,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
)
),
cache_(ITstream("cache", tokenList())()),
caching_(false),
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
defaultRelaxationFactor_(0),
solvers_(ITstream("solvers", tokenList())())
......@@ -150,12 +151,19 @@ Foam::label Foam::solution::upgradeSolverDict
bool Foam::solution::cache(const word& name) const
{
if (debug)
if (caching_)
{
Info<< "Find cache entry for " << name << endl;
}
if (debug)
{
Info<< "Cache: find entry for " << name << endl;
}
return cache_.found(name);
return cache_.found(name);
}
else
{
return false;
}
}
......@@ -248,6 +256,7 @@ bool Foam::solution::read()
if (dict.found("cache"))
{
cache_ = dict.subDict("cache");
caching_ = cache_.lookupOrDefault<Switch>("active", true);
}
if (dict.found("relaxationFactors"))
......
......@@ -37,6 +37,7 @@ SourceFiles
#define solution_H
#include "IOdictionary.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -56,6 +57,9 @@ class solution
//- Dictionary of temporary fields to cache
dictionary cache_;
//- Switch for the caching mechanism
Switch caching_;
//- Dictionary of relaxation factors for all the fields
dictionary relaxationFactors_;
......
......@@ -76,7 +76,7 @@ public:
{}
//- Construct from components
objectHit(const bool success, const label& obj)
objectHit(const bool success, const label obj)
:
hit_(success),
hitObject_(obj)
......@@ -111,7 +111,7 @@ public:
{
return ((a.hit_ == b.hit_) && (a.hitObject_ == b.hitObject_));
}
friend bool operator!=(const objectHit& a, const objectHit& b)
{
return (!(a == b));
......
......@@ -107,7 +107,7 @@ public:
//- Incrementally hash a label.
// This will necessarily return a different value than the
// non-incremental version.
unsigned operator()(const label& p, unsigned seed) const
unsigned operator()(const label p, unsigned seed) const
{
return Hasher(&p, sizeof(label), seed);
}
......@@ -115,11 +115,10 @@ public:
//- Return the unsigned representation of a label.
// This helps if people have relied on the hash value corresponding to
// the natural order.
unsigned operator()(const label& p) const
unsigned operator()(const label p) const
{
return p;
}
};
......
......@@ -47,8 +47,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// construct given seed
Random::Random(const label& seed)
Random::Random(const label seed)
{
if (seed > 1)
{
......
......@@ -61,7 +61,7 @@ public:
// Constructors
//- Construct given seed
Random(const label&);
Random(const label);
// Member functions
......@@ -70,14 +70,19 @@ public:
//- scalar [0..1] (so including 0,1)
scalar scalar01();
//- vector with every component scalar01
vector vector01();
//- sphericalTensor with every component scalar01
sphericalTensor sphericalTensor01();
//- symmTensor with every component scalar01
symmTensor symmTensor01();
//- tensor with every component scalar01
tensor tensor01();
//- label [lower..upper]
label integer(const label lower, const label upper);
......
......@@ -74,7 +74,7 @@ bool Foam::ensightFile::allowUndef(bool value)
}
Foam::scalar Foam::ensightFile::undefValue(const scalar& value)
Foam::scalar Foam::ensightFile::undefValue(const scalar value)
{
// enable its use too
allowUndef_ = true;
......@@ -133,7 +133,7 @@ Foam::Ostream& Foam::ensightFile::write(const string& value)
}
Foam::Ostream& Foam::ensightFile::write(const label& value)
Foam::Ostream& Foam::ensightFile::write(const label value)
{
if (format() == IOstream::BINARY)
{
......@@ -157,7 +157,7 @@ Foam::Ostream& Foam::ensightFile::write(const label& value)
Foam::Ostream& Foam::ensightFile::write
(
const label& value,
const label value,
const label fieldWidth
)
{
......@@ -181,7 +181,7 @@ Foam::Ostream& Foam::ensightFile::write
}
Foam::Ostream& Foam::ensightFile::write(const scalar& value)
Foam::Ostream& Foam::ensightFile::write(const scalar value)
{
if (format() == IOstream::BINARY)
{
......
......@@ -103,7 +103,7 @@ public:
//- Assign the value to represent undef in the results
// Returns the previous value
// NB: do not use values larger than floatScalarVGREAT
static scalar undefValue(const scalar&);
static scalar undefValue(const scalar);
// Output
......@@ -124,13 +124,13 @@ public:
Ostream& write(const string& value);
//- write integer as "%10d" or as binary
Ostream& write(const label& value);
Ostream& write(const label value);
//- write integer with specified width or as binary
Ostream& write(const label& value, const label fieldWidth);
Ostream& write(const label value, const label fieldWidth);
//- write float as "%12.5e" or as binary
Ostream& write(const scalar& value);
Ostream& write(const scalar value);
//- Add carriage return to ascii stream
void newline();
......
......@@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "cellTable.H"
......@@ -81,7 +79,7 @@ void Foam::cellTable::addDefaults()
void Foam::cellTable::setEntry
(
const label& id,
const label id,
const word& keyWord,
const word& value
)
......@@ -192,7 +190,7 @@ Foam::Map<Foam::word> Foam::cellTable::names
}
Foam::word Foam::cellTable::name(const label& id) const
Foam::word Foam::cellTable::name(const label id) const
{
word theName("cellTable_" + Foam::name(id));
......@@ -289,19 +287,19 @@ Foam::Map<Foam::word> Foam::cellTable::shells() const
void Foam::cellTable::setMaterial(const label& id, const word& matlType)
void Foam::cellTable::setMaterial(const label id, const word& matlType)
{
setEntry(id, "MaterialType", matlType);
}
void Foam::cellTable::setName(const label& id, const word& name)
void Foam::cellTable::setName(const label id, const word& name)
{
setEntry(id, "Label", name);
}
void Foam::cellTable::setName(const label& id)
void Foam::cellTable::setName(const label id)
{
iterator iter = find(id);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment