Double sampling of cell label using cuttingPlane???
Dear Foamers,
I'm using the cuttingPlane class to sample information on a plane during a simulation run. I then use the .cutCells() function to retrieve the cells cut by my plane. But in the labelList returned, every cell cut is sampled twice instead of once.. Any idea why?? My code is: Code:
point pnt_1(1.5, 1, 2); Code:
cutCellsPlane_1 face-> 1 Kind regards, Francois. |
Quote:
http://foam.sourceforge.net/doc/Doxy....html#_details |
Dear Mark,
Thank you for you reply! I did indeed read in the doxygen documentation that there could be triangulation involved, but I don't understand why that should return a .cutCells() list returning every cell twice. Especially on a Cartesian orthogonal grid.. Could you explain to me why triangulation would give me such a result? Kind regards, Francois. |
Quote:
The following code snippet from cuttingPlane.C explains what is happening inside: Code:
Code:
const bool triangulate = true; // temporary hack for Francois The good news is that triangulation/non-triangulation of cuttingPlane is an option in the next OpenFOAM release, so you won't need this hack in later releases. |
Dear Mark,
Once again, thank you for your swift reply! As I was using an orthogonal grid for the time being and needed an fix fast to get my simulation running, I wrote a simple routine filtering out the cells listed twice in my cell list. Not very elegant, I know, but it did the job until I found a better way of doing it. Now that the urgency to get my simulation running is gone, I can search for a better solution. So thank your piece of code! It definitely looks like a more elegant solution! I will implement it, see how it works, and if I need triangulation, I will know which boolean I have to change to get it back. Kind regards, Francois. |
Quote:
|
Dear Mark,
Well, it appears I keep getting more reasons to thank you! I had only vaguely heard of HashSet until today, although it appears to be used in quite fundamental handling of objects in OpenFOAM... :o But after greping and doxygen-ing around and what not, I came up indeed with a very short piece of code to do my filtering! Code:
labelHashSet myHashList(myCutCellsLabelList); Thank you for the comments! Kind regards, François. |
Quote:
You indeed have the type of code I was thinking about. For some cases the PackedBoolList might be faster (you can try the applications/test/PackedList2/ if you'd like). The only way to shorten your code (which is already quite short) would be to skip intermediates: Code:
const labelList myFilteredList(labelHashSet(cutPln.cutCells()).toc()); |
Dear Mark,
Well, thank you, once more! It works! :) It was a bit odd because the compiler started by being cranky, not wanting to compile the code, so I changed it back to the original code, compiled, and retried with exactly the same inline code once more, and it worked.. Dont ask.. :confused: On a totally different topic, you wouldn't happen to be familiar with the reduce() function to reconstruct data across processors by any chance? Kind regards, Francois. |
Quote:
For your sample plane application, it could get used something like this: Code:
// count all faces |
All times are GMT -4. The time now is 02:05. |