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

labelListList handling

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2011, 08:31
Default labelListList handling
  #1
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello together

Can anyone tell me how to find out the length of the lists in a labelListList?
Is there a function or do I have to iterate with a counter through the lists?

Thanks a lot
Peter Müller is offline   Reply With Quote

Old   October 26, 2011, 03:00
Default
  #2
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Hi Peter,
means that the labelListList is just a List<> field with the List<label>,
so my guess is that you have to loop through to get the sizes. Check out
ListOps.H and ListListOps.H for generic algorithms defined on List<> and
List<List<> >.

Hope this helps,

Tomislav
tomislav_maric is offline   Reply With Quote

Old   October 26, 2011, 09:12
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Peter Müller View Post
Hello together

Can anyone tell me how to find out the length of the lists in a labelListList?
Is there a function or do I have to iterate with a counter through the lists?
Take a look in ListListOps.H, the subSizes operation looks like what you want (haven't used it myself):

http://foam.sourceforge.net/docs/cpp...c0824cbecb892b
olesen is offline   Reply With Quote

Old   October 27, 2011, 04:24
Default
  #4
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello together

Thanks a lot for your answers. I'm quite new in OpenFOAM and C++.
I have another question. When I try to create an exetuble with the wmake, I get the error

‘labeListList’ does not name a type

labelListList was used in my code like that:

const labeListList& FacesToPoint = cylField.pointFaces();

Where cylField is a vectorField which was created by a coordinate transform with cylindricalCS. What's the problem with my declaration?

An other problem is that i get an error while performing the coordinate transform:

error: no matching function for call to ‘Foam::cylindricalCS::globalToLocal(const Foam::Vector<double>&)’

Thanks
Peter Müller is offline   Reply With Quote

Old   October 27, 2011, 04:34
Default
  #5
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Quote:
Originally Posted by Peter Müller View Post
Hello together

Thanks a lot for your answers. I'm quite new in OpenFOAM and C++.
I have another question. When I try to create an exetuble with the wmake, I get the error

‘labeListList’ does not name a type

labelListList was used in my code like that:

const labeListList& FacesToPoint = cylField.pointFaces();

Where cylField is a vectorField which was created by a coordinate transform with cylindricalCS. What's the problem with my declaration?

An other problem is that i get an error while performing the coordinate transform:

error: no matching function for call to ‘Foam::cylindricalCS::globalToLocal(const Foam::Vector<double>&)’

Thanks
Hi Peter,

those errors are compiler errors: there is no code in your program that implements (declares/defines) a labelListList. This type is a low-level container used by OpenFOAM. Have you created your .C and .H files manually for your application, or have you used:

Code:
foamNew source App appName
where "appName" is the name of your application, in your application directory?

Just in case you haven't used "foamNew" so far:

1) create the directory named as your application
2) change to this directory
3) execute the command above
4) edit Make/files and add "appName.C" in the first line
5) wmake

As for the cylindricalCS error:

error: no matching function for call to ‘Foam::cylindricalCS::globalToLocal(const Foam::Vector<double>&)’

Check out the cylindricalCS.H, in there you will find globalToLocal member functions:

there is a "bool" argument given to the functions as well that you need to define (bool translate).

If you are using a class, always go and find it using the Doxygen or in the source, and check out the declaration, this explains how it should be used...

Hope this helps..
tomislav_maric is offline   Reply With Quote

Old   October 27, 2011, 07:25
Default
  #6
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hi Maric

Thanks a lot for your quick reply. I created my application folder manually, but the files-and options files looks the same. The aim of this application is to create a mixingplane patch. At the moment I try to implement an algorithm who is able to detect the corner-points of the original mesh.

The class is named mpPolyPatch and inherits form PolyPatch. Since this is somehow similar to what coupledPolyPatch.C does, I took coupledPolyPatch as basic structure and tried to change it so that it fits to my requests.

Do I need another header-file to include/declare the class labelListList or do I have to specify some additional directories in the options-file of the MAKE-folder?

Thanks Peter
Peter Müller is offline   Reply With Quote

Old   October 27, 2011, 08:00
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
If you really use this:
Code:
const labeListList& FacesToPoint = cylField.pointFaces();
Then it is only a typo, since you write labe instead of label.
Bernhard is offline   Reply With Quote

Old   October 27, 2011, 08:21
Default
  #8
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
If you really use this:
Code:
const labeListList& FacesToPoint = cylField.pointFaces();
Then it is only a typo, since you write labe instead of label.
of course.
tomislav_maric is offline   Reply With Quote

Old   October 27, 2011, 08:32
Default
  #9
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Thanks so much. You wan't believe how long I tried to find the bug...
Today was a very efficient day :-)
Peter Müller is offline   Reply With Quote

Old   October 27, 2011, 08:45
Default
  #10
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Quote:
Originally Posted by Peter Müller View Post
Thanks so much. You wan't believe how long I tried to find the bug...
Today was a very efficient day :-)
it's allways like this for me as well... I've spent the last 3 days trying to find a bug in the geometrical algorithm I'm working on, it turned out to be a rounding error..

This is my reaction when this happens:

Of course.
tomislav_maric is offline   Reply With Quote

Old   October 27, 2011, 11:14
Default
  #11
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
It seams that I was able to compile my application mpPolyPatch.C with "wmake libso". Can you tell me whether there is a possibility to check whether everthing wen't allright. For example check whether the new polyPatch, mpPolyPatch, is available in the library?

Thanks
Peter Müller is offline   Reply With Quote

Old   October 28, 2011, 03:58
Default
  #12
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Quote:
Originally Posted by Peter Müller View Post
It seams that I was able to compile my application mpPolyPatch.C with "wmake libso". Can you tell me whether there is a possibility to check whether everthing wen't allright. For example check whether the new polyPatch, mpPolyPatch, is available in the library?

Thanks

If you have compiled it, it should be available. Check out the Make/files and see the line

Code:
LIB = $(FOAM_USER_LIBBIN)/libSomeName
If you want to use this library, then you need to include the header file myPolyPatch.H in the application that will use it. After that, you should edit the Make/options file and put this at the end of the list EXE_INC:

Code:
-I/path/to/myPolyPatch/directory/lnInclude
so that wmake knows where are the include files of the myPolyPatch (modify this so that it suits your situation of course, this is just an explanation). Also, in Make/options file, add

Code:
-llSomeName
where SomeName is the name of the library into which you have compiled myPolyPatch.


Note: in Make/options, every line in the directory/lib lists must end with "\" without the space (this doesn't work "\ "), except for the last one.
tomislav_maric is offline   Reply With Quote

Old   October 28, 2011, 11:11
Default
  #13
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello Maric

Thank you so much for all your explanations. Until now the algorithm is able to properly detect the corner points of the boundary patch. What I would like to do now is reconstruct the edges surrounding the patch.

I have created a labelListList containing a list with points and the edges according to each point.

I did this with:

const labelListList& edgesToPoint = this->pointEdges()

I would now like to create a list of the points shared by one edge but I could not find a function like

const labelListList& edgesToPoint = this->edgePoints();

Do I have to loop through the pointEdges labelListList to find the points according to one edge?

Thanks a lot
Peter Müller is offline   Reply With Quote

Old   October 31, 2011, 05:10
Default
  #14
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello together

I would like to create something like an array where I can store integers inside. The reason why it is something is that I don't know the final length of the array and would therefore like to have something where I don't have to devine this.

I was thinking about a list but I'm not sure whether this would be the right choice and if yes i don't really know how I have to declare it correctly.

Can I write something like this?

List<int> myIntList;

Thanks a lot
Peter Müller is offline   Reply With Quote

Old   October 31, 2011, 06:49
Default
  #15
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Peter Müller View Post
Hello together

I would like to create something like an array where I can store integers inside. The reason why it is something is that I don't know the final length of the array and would therefore like to have something where I don't have to devine this.

I was thinking about a list but I'm not sure whether this would be the right choice and if yes i don't really know how I have to declare it correctly.

Can I write something like this?

List<int> myIntList;

Thanks a lot
Looks fine. There is no major difference between a List<int> and a List<label> (since label is currently just a typedef for int), but I'd generally stick to using List<label> or labelList for consistency with the rest of OPENFOAM. Depending on your needs, a DynamicList might also be useful to consider if you are intending to a lot of resizing operations.
olesen is offline   Reply With Quote

Old   November 2, 2011, 04:42
Default
  #16
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello

I'd like to use the Foam memberfunction polySplineEdge but it always tells me that polySplineEdge is not a memberfunction of Foam. If I take a look at the Doxygen "documentation" I find Foam:olySplineEdge.

I tried to use it like this:

pointField mySpline = Foam:olySplineEdge(.....)

Thanks
Peter Müller is offline   Reply With Quote

Old   June 25, 2012, 08:46
Default
  #17
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Hello together

Does anybody know how to create a labelList like it is possible with the integer arrays? Something like:

labelList myLabelList = {3, 1, 5, 7, 8}

Or even better, how to create a labelListList

labelListList myLabelListList = {3, 1, 5, 7, 8},
{2, 3},
{3,1,8},
{...................

I would like to test an utility and it would simplify the testing a lot if it would be possible to create labelListList somehow like this.

Thanks in advance
Peter Müller is offline   Reply With Quote

Old   June 25, 2012, 08:54
Default
  #18
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Peter Müller View Post
Hello together

Does anybody know how to create a labelList like it is possible with the integer arrays? Something like:

labelList myLabelList = {3, 1, 5, 7, 8}

Or even better, how to create a labelListList

labelListList myLabelListList = {3, 1, 5, 7, 8},
{2, 3},
{3,1,8},
{...................

I would like to test an utility and it would simplify the testing a lot if it would be possible to create labelListList somehow like this.

Thanks in advance
A direct construction isn't so easy without lots of tricks.
Doesn't look really pretty, but I don't see why a stream constructor should not work:
Code:
    labelListList myLabListList(IStringStream(
"("
  "(3 1 5 7 8)"
  "(2 3)"
  "(3 1 8)
")"
)());
olesen is offline   Reply With Quote

Old   June 25, 2012, 10:39
Default
  #19
Member
 
Join Date: Oct 2011
Posts: 37
Rep Power: 14
Peter Müller is on a distinguished road
Thank you very much. This works fine for me.
Have a nice day.
Peter Müller is offline   Reply With Quote

Old   May 20, 2014, 05:49
Default
  #20
New Member
 
Join Date: Oct 2013
Posts: 19
Rep Power: 12
Daniel73 is on a distinguished road
Hi,
Does anybody know how to create a dynamic labelListList ?
Because when i write : "const labelListList & listlist; " i get the error because of non-initialization.
Do you have any suggestion to create empty labelListList?because i don't want to initialize it in declaration step...
Tnx
Daniel73 is offline   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
Problem with handling LES modeling with dynamic mesh g.akbari OpenFOAM Running, Solving & CFD 0 March 8, 2010 16:18
Error%7eerror triggers crash after handling exceptions thrown by errorexit twice 7islands OpenFOAM Bugs 2 September 4, 2007 05:24
Handling axisymmetry terms on the symmetry line Sonny Main CFD Forum 4 December 9, 2005 16:22
macros handling vectors sivakumar FLUENT 0 January 18, 2002 16:16


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