CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Access (x y z) coordinates of cellSet (https://www.cfd-online.com/Forums/openfoam-programming-development/165521-access-x-y-z-coordinates-cellset.html)

hxaxtma January 19, 2016 09:40

Access (x y z) coordinates of cellSet
 
Hi guys,

I try to access the coordinates of a cellSet.

Code:

const labelList& sensorCell = sensorCells.toc(); // Access celSet HashList via TOC

forAll(sensorCell,i)
{
    const volVectorField& C_sensor = mesh[sensorCell[i]].C(); -
    //volScalarField Cx_sensor = C_sensor.component(0);           
}

I knew to access coordinates with mesh.C().component(0), this is here not really working cause of the cellSet saved as Hashlist.

Is there any other function I am missing?

Thanks in advance

hxaxtma January 21, 2016 05:40

For those who are interested, I solved it that way:

Code:

    const volVectorField& C = mesh.C(); // Get Mesh Coordinates of all Cells as Vector
    vector C_sensor=C[sensorCell[i]];  // Loop only over cellSet
    scalar Cx_sensor=C_sensor.component(0); //Coordinate Components x,y,z of sensorCellSet
    scalar Cy_sensor=C_sensor.component(1);
    scalar Cz_sensor=C_sensor.component(2);



All times are GMT -4. The time now is 23:26.