Added initialising constructor and use it is the BSpline code.

This commit is contained in:
henry 2009-10-26 21:54:53 +00:00
parent 135f8275ac
commit 86c3affb5b
3 changed files with 23 additions and 3 deletions

View File

@ -32,7 +32,20 @@ template<class Type>
Foam::simpleMatrix<Type>::simpleMatrix(const label mSize) Foam::simpleMatrix<Type>::simpleMatrix(const label mSize)
: :
scalarSquareMatrix(mSize), scalarSquareMatrix(mSize),
source_(mSize, pTraits<Type>::zero) source_(mSize)
{}
template<class Type>
Foam::simpleMatrix<Type>::simpleMatrix
(
const label mSize,
const scalar coeffVal,
const Type& sourceVal
)
:
scalarSquareMatrix(mSize, mSize, coeffVal),
source_(mSize, sourceVal)
{} {}

View File

@ -26,7 +26,7 @@ Class
Foam::simpleMatrix Foam::simpleMatrix
Description Description
Foam::simpleMatrix A simple square matrix solver with scalar coefficients.
SourceFiles SourceFiles
simpleMatrix.C simpleMatrix.C
@ -75,8 +75,13 @@ public:
// Constructors // Constructors
//- Construct given size //- Construct given size
// Note: this does not initialise the coefficients or the source.
simpleMatrix(const label); simpleMatrix(const label);
//- Construct given size and initial values for the
// coefficients and source
simpleMatrix(const label, const scalar, const Type&);
//- Construct from components //- Construct from components
simpleMatrix(const scalarSquareMatrix&, const Field<Type>&); simpleMatrix(const scalarSquareMatrix&, const Field<Type>&);
@ -91,11 +96,13 @@ public:
// Access // Access
//- Return access to the source
Field<Type>& source() Field<Type>& source()
{ {
return source_; return source_;
} }
//- Return const-access to the source
const Field<Type>& source() const const Field<Type>& source() const
{ {
return source_; return source_;

View File

@ -48,7 +48,7 @@ Foam::pointField Foam::BSpline::findKnots
register scalar oneSixth = 1.0/6.0; register scalar oneSixth = 1.0/6.0;
register scalar twoThird = 2.0/3.0; register scalar twoThird = 2.0/3.0;
simpleMatrix<vector> M(newnKnots); simpleMatrix<vector> M(newnKnots, 0, vector::zero);
// set up the matrix // set up the matrix