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

How to access cellSet elements?

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 8, 2018, 18:35
Default How to access cellSet elements?
  #1
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
In my code, I can add cell IDs to a cellSet


Code:
cellSet myCellSet
(
   IOobject
    (

    "myCellSet",
    runTime.timeName(),
    runTime,
    IOobject::MUST_READ,
    IOobject::AUTO_WRITE

    )

);
myCellSet.clear();

const volVectorField& C = mesh.C();
const vector origin(0.0,0.0,0.0);

forAll(C, i)
{
      if((mag(C[i] - origin) < 0.6) && (mag(C[i] - origin) > 0.5) )
      {
           myCellSet.insert(i);

      }

}
The problem is that I cannot retrieve elements from the cellSet (I mean it is obvious to use the following syntax to get the first element: myCellSet[0], but this gives something irrelevant. As far as I know I use only the following syntax (exmple to retrieve the first element):
Code:
Info << myCellSet.sortedToc()[0] << endl;
Can you please tell me what is the correct way to retrieve elements from a cellSet.
NOTE: The code works very well and the myCellSet is written to the directories (the remaining code is not shown here).

In summary the question is very simple:
Why the following syntax doesn't give the expected result:
Code:
myCellSet[0]
[COLOR=inherit !important]


#s3gt_translate_tooltip_mini { display: none !important; }
[/COLOR]
anon_q is offline   Reply With Quote

 


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
Access to cellid in cellSet Tobi OpenFOAM Programming & Development 5 April 16, 2017 21:05
Access (x y z) coordinates of cellSet hxaxtma OpenFOAM Programming & Development 1 January 21, 2016 05:40
Ansys SIG$ILL error loth ANSYS 3 December 24, 2015 05:31
How can I access to a volTensorField elements? urgent!!! adambarfi OpenFOAM Running, Solving & CFD 6 May 14, 2013 16:28
CFX4.3 -build analysis form Chie Min CFX 5 July 12, 2001 23:19


All times are GMT -4. The time now is 08:56.