|
[Sponsors] |
![]() |
![]() |
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,713
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 |
|
![]() |
![]() |
![]() |
![]() |
#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 |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,713
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 |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,713
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 |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
New Member
Haixuan Ye
Join Date: May 2012
Location: Ann Arbor, MI, USA
Posts: 4
Rep Power: 15 ![]() |
Quote:
I suggest to use test.toc() to access the contents of the table directly. Code:
test.toc() |
||
![]() |
![]() |
![]() |
![]() |
#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]]; } |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[DesignModeler] DesignModeler Scripting: How to get Full Command Access | ANT | ANSYS Meshing & Geometry | 53 | February 16, 2020 15:13 |
[snappyHexMesh] MultiRegion(Snappy): how to define new zones | Cartuns11 | OpenFOAM Meshing & Mesh Conversion | 6 | May 3, 2019 12:02 |
irregular model simulation with chtMultiregionFoam | lg88 | OpenFOAM | 59 | July 28, 2016 11:44 |
Creating a cellSet fom yPlus | buffi | OpenFOAM Post-Processing | 0 | December 17, 2012 04:19 |
Online libraries - with access to Journals | momentum_waves | Main CFD Forum | 2 | December 12, 2007 10:08 |