CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   scalarMatrix (

flowris March 27, 2012 12:10

I am trying to convert an older mesh motion class from 1.5-dev to 2.0.x. The compiler gives me the following error:

RBFInterpolation.H:102: error: ISO C++ forbids declaration of ‘scalarMatrix’ with no type
Indeed, on this line, we can find

        mutable scalarMatrix* BPtr_;
How can we use scalarMatrix in 2.0.x?

marupio March 27, 2012 12:32

The matrix class structures changed between 1.5 and 1.6 and caused me a bit of a headache. I don't remember the details, but you can look at the implementations of ODE solvers between the two versions to see what you need to change.

flowris March 28, 2012 11:25


Thank you for this tip. I tried to find files containing scalarMatrix, without succes. I looked in scalarMatrices.C and, as far as I understand, one has to chose between the subclasses. So I changed all scalarMatrix to scalarRectangularMatrix, which seems the most general subclass.

Now, I have another error that I could not overcome:

SOURCE=RBFMotionFunctionObject.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/dynamicMesh/lnInclude -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/finiteVolume/lnInclude -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/meshTools/lnInclude -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/triSurface/lnInclude -IlnInclude -I. -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude -I/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/RBFMotionFunctionObject.o
In file included from RBFMotionFunctionObject.H:42,
                from RBFMotionFunctionObject.C:30:
/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude/functionObject.H: In static member function ‘static Foam::autoPtr<Foam::functionObject> Foam::functionObject::adddictionaryConstructorToTable<functionObjectType>::New(const Foam::word&, const Foam::Time&, const Foam::dictionary&) [with functionObjectType = Foam::RBFMotionFunctionObject]’:
/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude/functionObject.H:91:  instantiated from ‘Foam::functionObject::adddictionaryConstructorToTable<functionObjectType>::adddictionaryConstructorToTable(const Foam::word&) [with functionObjectType = Foam::RBFMotionFunctionObject]’
RBFMotionFunctionObject.C:46:  instantiated from here
/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude/functionObject.H:84: error: cannot allocate an object of abstract type ‘Foam::RBFMotionFunctionObject’
RBFMotionFunctionObject.H:58: note:  because the following virtual functions are pure within ‘Foam::RBFMotionFunctionObject’:
/home/jmatthei/OpenFOAM/OpenFOAM-2.0.x/src/OpenFOAM/lnInclude/functionObject.H:152: note:    virtual bool Foam::functionObject::execute(bool)
make: *** [Make/linux64GccDPOpt/RBFMotionFunctionObject.o] Error 1

RBFMotionFunctionObject inherits from functionObject, and both have the member function virtual bool execute(); so I don't really see the problem.


marupio March 28, 2012 17:55

I don't know much about the classes you are working with, but I've dealt with that error before. The compiler is complaining that you are trying to create an instance of pure virtual object. Pure virtual objects cannot be created... they only exist as a part of a logical class structure. You have to go down the class structure and find a suitable derived object. The only way you can tell if the class is "pure virtual" or not is: pure virtual objects are missing the implementation of at least one function. The compiler is telling you which function is missing: execute(). So either find another object that inherits RBFMotionFunctionObject, or implement execute() in this class yourself.

Share and enjoy!


All times are GMT -4. The time now is 13:01.