CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

refCast compilation and understanding error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2014, 06:03
Default refCast compilation and understanding error
  #1
New Member
 
Martin K
Join Date: Jan 2013
Location: Germany
Posts: 28
Rep Power: 13
Martin_K_lalelu is on a distinguished road
Hi all,

while trying to move a mesh by modifying the pointDisplacement file out of my solver, I got stuck. I could really need some help using and understanding refCast.

Here is what I got:

Code:
    pointVectorField& PointDisplacement = refCast<pointVectorField&>
    (
        mesh.objectRegistry::lookupObject<pointVectorField>
        (
        "pointDisplacement"
        )
    );
    
     vectorField& pDisp = PointDisplacement.internalField();
    vectorField& pDispOld = pDisp;
    
     pDisp == vector (0,0,0.001)+pDispOld;
The corresponding compilation error:

Code:
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H: In instantiation of ‘To& Foam::refCast(From&) [with To = Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>&; From = const Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>]’:
../pointDisplacementInterFace.H:15:2:   required from here
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H:110:35: error: cannot dynamic_cast ‘r’ (of type ‘const class Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>’) to type ‘class Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>&’ (conversion casts away constness)
         return dynamic_cast<To&>(r);
                                   ^
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H:116:28: error: ‘typeName’ is not a member of ‘Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>&’
             << " to type " << To::typeName
                            ^
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H:119:35: error: cannot dynamic_cast ‘r’ (of type ‘const class Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>’) to type ‘class Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>&’ (conversion casts away constness)
         return dynamic_cast<To&>(r);
                                   ^
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H: In function ‘To& Foam::refCast(From&) [with To = Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>&; From = const Foam::GeometricField<Foam::Vector<double>, Foam::pointPatchField, Foam::pointMesh>]’:
/home/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/typeInfo.H:121:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [Make/linux64GccDPOpt/myInterDyMFoam.o] Fehler 1
Martin_K_lalelu is offline   Reply With Quote

Old   April 26, 2018, 20:14
Default
  #2
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 11
Scram_1 is on a distinguished road
Hey,
I'm getting the same error. Did you manage to figure it out?

Best,
Scram_1
Scram_1 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to setup a simple OpenFOAM cluster? TommiPLaiho OpenFOAM Installation 3 October 27, 2013 16:15
fireFoam.1.7.x_0.4 compilation error !link OpenFOAM Installation 9 December 24, 2012 05:15


All times are GMT -4. The time now is 02:25.