CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   List of plane (https://www.cfd-online.com/Forums/openfoam-programming-development/96765-list-plane.html)

Mjoelnir January 31, 2012 11:05

List of plane
 
Hi Everyone,

i want to create a list of planes

==>

Code:


    vector n (0, 0, 1);
   
    point d (0.25,0.25,0.25);   
   
        plane cutPlane(d,n);
    scalar a(1);

    List<plane> b;

    b.append(cutPlane);

but the compiler yells at me:

Code:

In file included from /opt/openfoam201/src/OpenFOAM/lnInclude/List.H:259:0,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/HashTable.C:30,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/Istream.H:184,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/ISstream.H:40,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/IOstreams.H:38,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/VectorSpace.C:27,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/VectorSpace.H:167,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/Vector.H:44,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/vector.H:39,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/point.H:35,
                from /opt/openfoam201/src/OpenFOAM/lnInclude/tetPointRef.H:34,
                from /opt/openfoam201/src/meshTools/lnInclude/momentOfInertia.H:40,
                from volFoam.C:32:
/opt/openfoam201/src/OpenFOAM/lnInclude/List.C: In member function ‘void Foam::List<T>::setSize(Foam::label) [with T = Foam::plane, Foam::label = int]’:
/opt/openfoam201/src/OpenFOAM/lnInclude/List.C:367:5:  instantiated from ‘void Foam::List<T>::setSize(Foam::label, const T&) [with T = Foam::plane, Foam::label = int]’
/opt/openfoam201/src/OpenFOAM/lnInclude/ListI.H:99:5:  instantiated from ‘void Foam::List<T>::append(const T&) [with T = Foam::plane]’
volFoam.C:120:19:  instantiated from here
/opt/openfoam201/src/OpenFOAM/lnInclude/List.C:331:41: error: no matching function for call to ‘Foam::plane::plane()’
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:139:9: note: candidates are: Foam::plane::plane(Foam::Istream&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:136:9: note:                Foam::plane::plane(const Foam::dictionary&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:133:9: note:                Foam::plane::plane(const Foam::scalarList&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:129:9: note:                Foam::plane::plane(const Foam::point&, const Foam::point&, const Foam::point&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:126:9: note:                Foam::plane::plane(const Foam::point&, const Foam::vector&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:123:9: note:                Foam::plane::plane(const Foam::vector&)
/opt/openfoam201/src/OpenFOAM/lnInclude/plane.H:62:1: note:                Foam::plane::plane(const Foam::plane&)
make: *** [Make/linuxGccDPOpt/volFoam.o] Fehler 1

but the list works fine i write

Code:

    scalar a(1);

    List<scalar> b;

    b.append(a);

Thank you for your help

Best regards

Henning

tomislav_maric January 31, 2012 11:15

The plane is missing an empty constructor, just add

Code:

plane() {};
in the public interface part of the class plane, or better yet, check out the latest version of OpenFOAM-1.6-ext (if this is what you are on), it has been fixed in the meantime, and compile the library only.

Code:

error: no matching function for call to ‘Foam::plane::plane()’
Means: I really need the function (constructor) plane(), but I can't find one.

Now, tell me, what are you using this for? :)

Mjoelnir January 31, 2012 11:48

i want to create the class cellcuts. For that i need the list of plane for the consructor.

In the end i want to calculate the volume of the cell cutted by the plane.

Mjoelnir January 31, 2012 12:03

Thank you for the quick response

im trying to change plane.C and plane.H

levka July 4, 2013 05:37

Did you manage to figure out how to define a object of "class plane"??

Quote:

Originally Posted by Mjoelnir (Post 342136)
Thank you for the quick response

im trying to change plane.C and plane.H


l_r_mcglashan July 4, 2013 06:42

Use PtrList<plane>.

levka July 4, 2013 07:06

Quote:

Originally Posted by l_r_mcglashan (Post 437749)
Use PtrList<plane>.

Code:

const point& p1=vector(0,0,0 );
const point& p2=vector(0,0,10 );
const point& p3=vector(0,0,20 );

PtrList<plane> Myplane(p1,p2,p3);

where is mistake?

l_r_mcglashan July 4, 2013 07:09

Code:

PtrList<plane> planes(3);

planes.set(0, new plane(point(0,0,0)));
planes.set(1, new plane(point(0,0,10)));
planes.set(2, new plane(point(0,0,20)));

Good luck!

levka July 4, 2013 08:05

Quote:

Originally Posted by l_r_mcglashan (Post 437756)
Code:

PtrList<plane> planes(3);

planes.set(0, new plane(point(0,0,0)));
planes.set(1, new plane(point(0,0,10)));
planes.set(2, new plane(point(0,0,20)));

Good luck!

Code:

error: ‘plane’ was not declared in this scope
And another code
Code:

point xyz(0,0,0) ;// choose the point through which //the plane goes

vector dir(0,0,1) ;// normal direction
plane plane1(xyz,dir);

cuttingPlane plane1(mesh, plane1);

gives an error:
Quote:

error: ‘plane’ does not name a type
error: ‘cuttingPlane’ does not name a type


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