|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 ![]() |
Hi all,
I'm trying to create a class which references the "mesh" class within itself. I want to call mesh.cells and mesh.C from within the class. Is there a way to use some kind of pointer within the constructor to do this? For other variables (like U) it can be done because its is of type volVectorField and the code is like: myClass::myClass(volVectorField& U_) I want to include a reference to the mesh class instead of the U_. Thanks, Tony |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 18 ![]() |
Hi Tony,
you can just do U_.mesh() and you have the reference to the mesh class. Hope this helps Kathrin |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 38 ![]() ![]() |
Hi Tony
Alternatively, your constructor call could be Code:
myClass::myClass(const fvMesh & mesh, volVectorField & U); Code:
myClass::myClass(const fvMesh & mesh, volVectorField & U) : mesh_(mesh) ... etc { } Code:
const fvMesh & mesh_; Niels |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 16 ![]() |
Thanks Kathrin,
That worked just fine. Thanks for the reply Niels, I will use the first approach though. Tony |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 00:35 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 20:30 |
G95 + CGNS | Bruno | Main CFD Forum | 1 | January 30, 2007 00:34 |
Building OpenFoAm on SGI Altix 64bits | anne | OpenFOAM Installation | 8 | June 15, 2006 09:27 |
meshing F1 front wing | Steve | FLUENT | 0 | April 17, 2003 12:37 |