CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Accessing member functions of class cell

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By ngj
  • 1 Post By alberto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2008, 09:28
Default Hi Forum Wish you all a nic
  #1
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
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 is offline   Reply With Quote

Old   August 26, 2008, 10:45
Default I wonder why no body answers w
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   August 26, 2008, 12:12
Default >I wonder why no body answers
  #3
nadine
Guest
 
Posts: n/a
>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
  Reply With Quote

Old   August 26, 2008, 12:50
Default Well Done I agree that my p
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   August 26, 2008, 16:57
Default Hi Jaswi I am very sorry fo
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
HesamAUT and openfoam_aero like this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   August 26, 2008, 17:05
Default Let's calm down a bit. Nadi
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
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
HesamAUT likes this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   August 26, 2008, 18:34
Default Hello Jaswinder, after readin
  #7
nadine
Guest
 
Posts: n/a
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
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing upstream cell - UDF bohis FLUENT 0 April 7, 2008 06:12
accessing the volume of a cell kk FLUENT 1 February 12, 2007 18:02
Accessing neighboring cells' cell number Daniel Lattin Siemens 4 October 20, 2006 17:19
Accessing a member function in a class fabianpk OpenFOAM 2 June 14, 2006 10:20
Accessing Neighbouring Cell info Murali Siemens 1 December 9, 2002 07:10


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