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 Objects (https://www.cfd-online.com/Forums/openfoam-programming-development/114427-list-objects.html)

JimKnopf March 11, 2013 04:13

List of Objects
 
Hello there,

i'm wondering about some "types" in Foam.

say I have a class foo
Code:

class foo
{
 foo();
void doSomeThing();
scalar returnSomeThin();

scalar value;
}

In a boundary condition i like to have one of these objects for every cell, how do I do this?

First Idea:
in my BC i define a list an do a loop over the list
Code:

static foam::List<foo> fooList
But what is the constructor for such a list? How do I set the size of the list?

In terms of basic c++ I would use a std::vector<foo> fooList, but this does not feel right for FOAM.

Anyone got an idea?

Best Regards,
Jim

marupio March 13, 2013 07:35

A PtrList would be suitable. Also, it can't be static because you need to know the mesh size.


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