I am trying to do computational PDE's with the Blitz++ library, and one thing I want to do is this:
I want to deal with 2-d arrays, but with knowledge of its "inner" part,
and an outer buffer ( of a certain # of rows / columns ) for ghost
cells in handling PDE's. So what I want to do is just have the
normal 2D array but with extra info, 4 ints keeping the number of ghost
cells on each side, and the number of points in the center (also for
convenience Range objects for the inner part of the matrix). So I
do the following in my compclass.h:
--------------------------------------------------------------------------------------------------------------
#include <blitz/array.h>
#include <blitz/array/stencil-et.h>
#include <iostream>
typedef Array<double, 2> scalarField;
class CompScalarField:public scalarField
{
public:
int numGhostLoX;
int numGhostHiX;
int numGhostLoY;
int numGhostHiY;
int numPoints;
Range Iinner, Jinner;
CompScalarField();
CompScalarField(int nglox, int nghix, int ngloy, int nghiy, int npoints);
};
--------------------------------------------------------------------------------------------------------------
And properly do the initializers etc. I thought this would work, but when in main.cpp I try to do something like:
--------------------------------------------------------------------------------------------------------------
u=CompScalarField(1,1,1,1,7);
u=3;
--------------------------------------------------------------------------------------------------------------
I get the following compiler error:
[45]cneff@plane:~/MultigrdC++$ make
g++ -pedantic -ansi -Wall -g -c main.cpp
main.cpp: In function `int main()':
main.cpp:22: no match for `CompVecField& = int' operator
compclass.h:13: candidates are: CompVecField& CompVecField::operator=(const
CompVecField&)
make: *** [main.o] Error 1
It may just be my lack of C++ knowledge (slowly learning), but I
thought that the operators would be inerited? What would be the
best way to do this thing? I don't want to do a has-a relationship when
this clearly is a is-a relationship. And I don't look forward to
the thought of passing this extra info around separately.
Thanks for your time,
-Chris Neff