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

Nested class and inheritance permissions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 20, 2013, 10:16
Default Nested class and inheritance permissions
  #1
New Member
 
Matteo
Join Date: Sep 2013
Location: Milan, Italy
Posts: 9
Rep Power: 12
MMC15 is on a distinguished road
Hello everybody!

I'm quite new both to OpenFoam and C++ language.

My problem, actually, is to create a class in which I need to create an object belonging to the treeDataFace class. Then , on this object, I need to call a method of the indexedOctree class, which is already contained in treeDataFace.h file. I have some problems in making the class.

Here's the code:
1) header file
Code:
#include "treeDataFace.H"
...
namespace Foam {
class intersectionData {
public:
        intersectionData(const fvMesh &iMesh);
        ~intersectionData();
...
void findCellIntersctPts(point &ipStart, point &ipEnd, const fvMesh &iMesh);

        treeBoundBox allBb;
        scalar bbTol;

        indexedOctree<treeDataFace> faceTree(treeDataFace(const bool &f,const fvMesh &iMesh),treeBoundBox &allBb,int(a),int(b) ,double(c));
    };
}
2).cpp file
Code:
#include "intersectionData.h"
...
#include "polyMesh.H"
#include "meshTools.H"
#include "treeDataFace.H"

namespace Foam {
intersectionData::intersectionData(const fvMesh &iMesh)
    {
...
indexedOctree<treeDataFace> faceTree
        (
    treeDataFace(false,iMesh),
    allBb,
    8,
    10, 
    3.0 
         );
        }
intersectionData::~intersectionData() {}
void intersectionData::findCellIntersctPts(point &ipStart, point &ipEnd, const fvMesh &iMesh)
{
...
    point p0
    point p1 
{
        pointIndexHit pHit = faceTree.findLine(p0, p1);
...
}

}
Making the file, the terminal returns this error:
Code:
intersectionData.cpp: In member function ‘void Foam::intersectionData::findCellIntersctPts(Foam::point&, Foam::point&, const Foam::fvMesh&)’:
intersectionData.cpp:95:35: error: ‘((Foam::intersectionData*)this)->Foam::intersectionData::faceTree’ does not have class type
      pointIndexHit pHit = faceTree.findLine(p0, p1);
I think that the problem concerns the calling of the method findLine, that is a method of the inner class indexedOctree.

I don't know how resolve, thank you in advance for your help!

Regards from Italy!
MMC15 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
function objects and virtual inheritance MichiB OpenFOAM Programming & Development 1 September 15, 2015 19:29
Doxygen documentation Tanay OpenFOAM Installation 9 September 23, 2011 11:40
Multiple inheritance, function pointers or? ngj OpenFOAM 0 March 20, 2009 10:36


All times are GMT -4. The time now is 23:08.