labelListList handling
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 |
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 |
Quote:
http://foam.sourceforge.net/docs/cpp...c0824cbecb892b |
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 |
Quote:
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 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.. |
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 |
If you really use this:
Code:
const labeListList& FacesToPoint = cylField.pointFaces(); |
Quote:
|
Thanks so much. You wan't believe how long I tried to find the bug...
Today was a very efficient day :-) |
Quote:
This is my reaction when this happens: :D Of course. |
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 |
Quote:
If you have compiled it, it should be available. Check out the Make/files and see the line Code:
LIB = $(FOAM_USER_LIBBIN)/libSomeName Code:
-I/path/to/myPolyPatch/directory/lnInclude Code:
-llSomeName 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. |
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 |
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 |
Quote:
|
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::polySplineEdge. I tried to use it like this: pointField mySpline = Foam::polySplineEdge(.....) Thanks |
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 |
Quote:
Doesn't look really pretty, but I don't see why a stream constructor should not work: Code:
labelListList myLabListList(IStringStream( |
Thank you very much. This works fine for me.
Have a nice day. |
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 |
@Daniel:
Quote:
If you need an empty object, do this: Code:
labelListList listlist; If you need a dynamic list of label lists, using the DynamicList template with default template arguments for container expansion, it looks like this: Code:
// Shorten the type name. Note the space between the last '> >' - Good luck, hope this helps.T |
Many Thanks :)
|
All times are GMT -4. The time now is 02:45. |