CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Accessing member functions of class cell (http://www.cfd-online.com/Forums/openfoam-solving/58609-accessing-member-functions-class-cell.html)

jaswi August 26, 2008 08:28

Hi Forum Wish you all a nic
 
Hi Forum

Wish you all a nice day

I have been trying to understand some basic classes of OpenFOAM and need some help on calling the member function of the class cell.

This class is located in:
/src/OpenFOAM/meshes/meshShapes/cell/

Before putting up the questions I would like to explain how does this comes into picture.
I am using the member functions of primitiveMesh listed under the section:

--> //Return mesh connectivity

Take for example the function:

const cellList& cells() const; - this one returns
a reference to a cellList which is a
typedef List<cell> cellList;

using it this way:

const cellList& trialList = mesh.cells();
Info << trialList << endl;

will give out a list of cells and each node of this list contains the list of faces comprising that particular cell:

25
(
6(0 1 45 55 60 85)
6(2 3 56 65 90 0)
6(4 5 57 70 95 2)
6(6 7 58 75 100 4)
6(8 50 59 80 105 6)
6(9 10 46 61 86 1)
6(11 12 66 91 3 9)
6(13 14 71 96 5 11)
6(15 16 76 101 7 13)
6(17 51 81 106 8 15)
6(18 19 47 62 87 10)
6(20 21 67 92 12 18)
6(22 23 72 97 14 20)
6(24 25 77 102 16 22)
6(26 52 82 107 17 24)
6(27 28 48 63 88 19)
6(29 30 68 93 21 27)
6(31 32 73 98 23 29)
6(33 34 78 103 25 31)
6(35 53 83 108 26 33)
6(36 40 49 64 89 28)
6(37 41 69 94 30 36)
6(38 42 74 99 32 37)
6(39 43 79 104 34 38)
6(44 54 84 109 35 39)
)

The above output indicates that my mesh has 25 cells and each cell has 6 faces.

If I iterate over this cellList like this:
forAll(trialList, trialListI)
{
Info << trialList[trialListI].nFaces() << endl;
}
6
6
6
6
6
....

each node is an object of class cell and i could call the nFaces() - which returns number of faces for the ith cell. It will print the number of faces for each cell and that is what it does:-), prints the number "6" 25 times:



Class cell has some more member functions such as:

--> labelList labels(const unallocFaceList&) const;

for example:
forAll(trialList, trialListI)
{
Info << trialList[trialListI].labels(???) << endl;
}

--> pointField points(const unallocFaceList&, const pointField&) const;

--> edgeList edges(const unallocFaceList&) const:

Anybody who knows how to use these member function please help me out. It might be possible that the same information could be possible using some other functions of the primitiveMesh class but I am interested in how to call in particular these memeber functions of class cell.

I thank you for reading the post and hope to learn something from your expertise.

Best Regards
Jaswi

jaswi August 26, 2008 09:45

I wonder why no body answers w
 
I wonder why no body answers when it is not related to installation or something which has been asked hundred times.

For the developers, the answer to this post is the easiest one could ask for.

I am sorry to spam in order to seek the answer and will try until i get the answer.

With all due respect to the developers and community
Jaswi

nadine August 26, 2008 11:12

>I wonder why no body answers
 
>I wonder why no body answers when it is not related to installation or something which has been asked hundred times.

So you consider you question more relevant than others? Then you probably have more knowledge than others and you can find your answer in the source code.

>For the developers, the answer to this post is the easiest one could ask for.

Sure. How much did you say you pay for this support?

>I am sorry to spam in order to seek the answer and will try until i get the answer.

Good luck! Does this forum have a filter option?

Nadine

jaswi August 26, 2008 11:50

Well Done I agree that my p
 
Well Done

I agree that my post was a bit too demanding but I could make out that you are working hard to earn yourself a reputation. Keep it up.

Next time do not waste your time in answering to the post instead try to contribute if you can.

It is always easy to behave the way you have been posting on this forum by remaining anonymous.

Feel free to strike back as you have been doing to others. I consider this thread and this forum closed for me from now onwards.

Jaswi

ngj August 26, 2008 15:57

Hi Jaswi I am very sorry fo
 
Hi Jaswi

I am very sorry for the treatment you have just recieved as it is utterly inappropriate and your questions in general can in my view only result in a kind and respectful answer.

I do sincerely hope that your view on this forum is written in a state of temporary frustration/anger, and that you will return, as you have been a positive and contributing part of this community, and your behaviour is in extreme contrast to others.

After reading this I sat down and figured out the way to use the member functions. It is done in the following way:

// Label list of the cell labels
const cellList & cc = mesh.cells();
// Label list of the face labels
const faceList & ff = mesh.faces();
// The coordinate sets for the individual points
const pointField & pp = mesh.points();

forAll(cc,tI)
{
// Return the point label for the points which the cell consists off.
Info << cc[tI].labels(ff) << endl;
// Return the coordinates for the points which the cell consists off.
Info << cc[tI].points(ff,pp) << endl;
// Return a list of label sets (2 labels per set), which defines an edge.
Info << cc[tI].edges(ff) << endl;
}

Hope it clears up the uncertainty, otherwise please ask.

Best regards,

Niels

alberto August 26, 2008 16:05

Let's calm down a bit. Nadi
 
Let's calm down a bit.

Nadine before judging you should at least know why Jaswinder asked these questions and why he might feel so upset. And I think you also should account for his contributions to the community, which, in my opinion, is something we forget too many times here around.

Jaswinder is trying to extensively document some parts of OpenFOAM in a consistent manner, and to release this work to the community when ready. I think he said that also on this discussion board. I'm reading his work, and I think it will be of great help for users.
In a single line, he pointed out a problem of this community, which is as old as the community itself: we share too few information on our progresses and we are not that willing to cooperate or to help others (with some evident exceptions).

This said, I don't really see the point of answers like "How much did you pay for this support?", because in a community of an open source project the point is not how much you pay, but how much you work with others and contribute to the community life. If it is not this way, "open" is simply a nice marketing word.

Unfortunately OpenFOAM doesn't work in this way, and I think many are understanding it, with the consequence that they don't even try to cooperate or stop almost immediately. Answers like these simply help to keep people away from the project, feeding this behaviour.

With kind regards,
Alberto

nadine August 26, 2008 17:34

Hello Jaswinder, after readin
 
Hello Jaswinder,
after reading Albertos answer I apologize for my reply. I simply remembered a few questions from your side followed by complains if you didn't get an immediate solution.
Knowing that you are working to improve the OpenFOAM documentation justifies your demanding tone to a great amount. If I had known that I would have been as supportive as I could. Keep it up ;-)

Nadine


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