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

How to access/manipulate sampling points?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 28, 2012, 04:49
Default How to access/manipulate sampling points?
  #1
Member
 
P.A.
Join Date: Mar 2009
Location: Germany
Posts: 83
Rep Power: 17
blaise is on a distinguished road
Hello Foamers,

I want to use the "sample" tool as a base for an own little application, where I need to access and manipulate the coordinates of the sampling points in a point cloud. After reading through the code of sample, sampledSet.H/C, sampledSets.H/C, IOOutputFilter.H/C, PtrList.H/C, etc. for days, I am feeling a bit lost in the complexity of this task. I think that the essential "magic" takes place by the definition of the "IOsampledSets sSets" variable, whereby the sampleDict is read and the sampling points are assigned to some sort of array (a PtrList array?). I cannot figure out how this is done exactly and how I can get access to this array.
I put the main function of "sample" here to make understanding my question easier; it is without surface sampling stuff, as I don't need it:

------------------------ snippet of the original sample code ----------------------
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedMesh.H"

IOsampledSets sSets
(
sampledSets::typeName,
mesh,
"sampleDict",
IOobject::MUST_READ,
true
);

forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

// Handle geometry/topology changes
polyMesh::readUpdateState state = mesh.readUpdate();

sSets.readUpdate(state);
sSets.write();
}

Info<< "End\n" << endl;
return 0;
}
------------------------------------ snippet end ------------------------

I want to calculate the locations of the sampling points between the definition of "sSets" and the "forAll" loop and to write the calculated positions into the right place in the sampledSets' data structure where the "forAll" loop can do its work on it.

Can anyone point me in the right direction on how to do that? I am fairly new to C++ and OpenFOAM coding, so I will need somehow detailed code examples from where I can go further.

Thank you!

Cheers,

Pascal.
blaise is offline   Reply With Quote

Old   November 29, 2012, 07:54
Default
  #2
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 93
Rep Power: 17
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
Hi,

Don't really know what exactly you wanted to sample. Do you want to sample data at a point or an iso-surface? Depending on what you want, you have to use specific function. For instance, sampling data at a point can be done with probe or extracting iso-surface can be done with sample. After knowing what you want to do, you can made your own sample function. Take a look at $FOAM_SRC/sampling, you will find the code of the function you want to use. Then you can modify these to get what you want.

Duong
duongquaphim is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
sampling interval and sampling frequency beauty FLUENT 13 November 9, 2022 08:23
[snappyHexMesh] .STL: non-closed manifold surface giulio.topazio OpenFOAM Meshing & Mesh Conversion 32 November 25, 2016 03:15
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[DesignModeler] DM's JScript: FPoint()'s GetPoint(i) function picks points backwards? ANT ANSYS Meshing & Geometry 2 July 23, 2012 15:25
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 07:36


All times are GMT -4. The time now is 13:24.