CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   List of Objects (

JimKnopf March 11, 2013 05:13

List of Objects
Hello there,

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

say I have a class foo

class 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

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,

marupio March 13, 2013 08: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 15:01.