|
[Sponsors] |
August 15, 2015, 11:49 |
Access to cellid in cellSet
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hello all,
If I read a cellSet like: Code:
cellSet foobar(mesh, nameOfSet); I did not figure it out how to get access to the values of the cellSet (cellId 's)? Any suggestion would be appreciated.
__________________
Keep foaming, Tobias Holzmann |
|
August 15, 2015, 13:07 |
|
#2 |
Senior Member
anonymous
Join Date: Aug 2014
Posts: 205
Rep Power: 13 |
As cellSet is a topoSet child class class maybe you can have a look in the way they use iterators and labels in topoSet, for example in the functions:
Foam::topoSet::invert Foam::topoSet::updateLabels Sorry that I cannot help you more, as my C++ knowledge is pretty basic |
|
August 15, 2015, 15:27 |
|
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Thanks for the replay.
I also checked topoSet in doxygen but I did not find any function. There has to be a way Foam is so awesome but I do not know the classes very well.
__________________
Keep foaming, Tobias Holzmann |
|
August 15, 2015, 15:43 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Solved!
As always soooo easy. I wanted to have access only to the cellSet cells in some postProcessing. Due to the fact that cellSet is inherit by a hash table. Therefore I get it with that: Code:
cellSet test(mesh, nameOfSet); forAll(mesh.C(), id) { if (test[id]) { //- Only get the cells which are included in the cellSet } }
__________________
Keep foaming, Tobias Holzmann |
|
September 13, 2016, 12:24 |
|
#5 | |
New Member
Haixuan Ye
Join Date: May 2012
Location: Ann Arbor, MI, USA
Posts: 4
Rep Power: 14 |
Quote:
I suggest to use test.toc() to access the contents of the table directly. Code:
test.toc() |
||
April 16, 2017, 22:05 |
Use the native access method provided by OpenFOAM
|
#6 |
New Member
Yu Cheng
Join Date: Aug 2014
Posts: 15
Rep Power: 12 |
Hey guys,
I am also looking for the access method to cellSet, after digging into the code, I found a native way provided by OpenFOAM in the file fvOption.C, see the lines (147-148) and lines (236-240). For convenience, I paste the code here Code:
cellSet selectedCells(mesh_, cellSetName_); cells_ = selectedCells.toc(); Code:
V_ = 0.0; forAll(cells_, i) { V_ += mesh_.V()[cells_[i]]; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[DesignModeler] DesignModeler Scripting: How to get Full Command Access | ANT | ANSYS Meshing & Geometry | 53 | February 16, 2020 16:13 |
[snappyHexMesh] MultiRegion(Snappy): how to define new zones | Cartuns11 | OpenFOAM Meshing & Mesh Conversion | 6 | May 3, 2019 13:02 |
irregular model simulation with chtMultiregionFoam | lg88 | OpenFOAM | 59 | July 28, 2016 12:44 |
Creating a cellSet fom yPlus | buffi | OpenFOAM Post-Processing | 0 | December 17, 2012 05:19 |
Online libraries - with access to Journals | momentum_waves | Main CFD Forum | 2 | December 12, 2007 11:08 |