From 86c3affb5b79a0b1dae80ea82b877acd835d79cf Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 26 Oct 2009 21:54:53 +0000 Subject: [PATCH] Added initialising constructor and use it is the BSpline code. --- src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C | 15 ++++++++++++++- src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H | 9 ++++++++- src/mesh/blockMesh/curvedEdges/BSpline.C | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C index ecc094a840..f412f20ee0 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C @@ -32,7 +32,20 @@ template Foam::simpleMatrix::simpleMatrix(const label mSize) : scalarSquareMatrix(mSize), - source_(mSize, pTraits::zero) + source_(mSize) +{} + + +template +Foam::simpleMatrix::simpleMatrix +( + const label mSize, + const scalar coeffVal, + const Type& sourceVal +) +: + scalarSquareMatrix(mSize, mSize, coeffVal), + source_(mSize, sourceVal) {} diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H index fd875281cc..0633cecc56 100644 --- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H +++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.H @@ -26,7 +26,7 @@ Class Foam::simpleMatrix Description - Foam::simpleMatrix + A simple square matrix solver with scalar coefficients. SourceFiles simpleMatrix.C @@ -75,8 +75,13 @@ public: // Constructors //- Construct given size + // Note: this does not initialise the coefficients or the source. simpleMatrix(const label); + //- Construct given size and initial values for the + // coefficients and source + simpleMatrix(const label, const scalar, const Type&); + //- Construct from components simpleMatrix(const scalarSquareMatrix&, const Field&); @@ -91,11 +96,13 @@ public: // Access + //- Return access to the source Field& source() { return source_; } + //- Return const-access to the source const Field& source() const { return source_; diff --git a/src/mesh/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C index 56e829eda5..8ce6695e94 100644 --- a/src/mesh/blockMesh/curvedEdges/BSpline.C +++ b/src/mesh/blockMesh/curvedEdges/BSpline.C @@ -48,7 +48,7 @@ Foam::pointField Foam::BSpline::findKnots register scalar oneSixth = 1.0/6.0; register scalar twoThird = 2.0/3.0; - simpleMatrix M(newnKnots); + simpleMatrix M(newnKnots, 0, vector::zero); // set up the matrix