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

Boolean function to mimic basic Octave function

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 2, 2013, 07:22
Default Boolean function to mimic basic Octave function
  #1
New Member
 
Join Date: Oct 2011
Posts: 27
Rep Power: 5
antoniofct is on a distinguished road
Hi all,

I am trying to do some simple thing that takes no more than 15 seconds to do in Octave but it is taking me some hours in c++.

Regarding dynamic mesh, when selecting points to move, there is already a function in OF that picks the boundary points and everything goes well.

It happens that I just want some of the boundary points to move..so I would like to get something like this:

I have a pointField XYZ;

I would like to compare the pointField.component(0) with a scalar 0 (or a scalarFeld e.g. pointField.component(0) > 0) and return a scalarField with 1 if it is true and 0 if it is false.

I have tried something like this:

scalarField test = bool ( pointField.component(0) > vector::zero.component(0));

but it tells me I can't use the > operator..

I could get a similar result with a loop, but I am trying to avoid it..

any hints?

Thank you

António
antoniofct is offline   Reply With Quote

Old   September 2, 2013, 09:23
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Something along the lines of:

scalarField test = pos ( pointField.component(0) - vector::zero.component(0) > 0);
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   September 2, 2013, 11:49
Default
  #3
New Member
 
Join Date: Oct 2011
Posts: 27
Rep Power: 5
antoniofct is on a distinguished road
thanks, that was it!
antoniofct is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Info message -> Fluent does not start Jenson FLUENT 0 December 22, 2011 18:21
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 07:27
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Please help about the VTKFoam liugx212 OpenFOAM Running, Solving & CFD 0 November 18, 2005 19:27


All times are GMT -4. The time now is 19:00.