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

How to get the x component of a point?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2016, 06:53
Question How to get the x component of a point?
  #1
New Member
 
Chengyu Wang
Join Date: Dec 2015
Posts: 7
Rep Power: 10
Gerwang is on a distinguished road
Hello Foamers!

I'm trying to modify decompose method, for which I need to get the x component of a point.

A series of points is defined like this:
Code:
pointField points
There is a way to get the value of its X component and it works like this:
Code:
points.component(vector::X)
What this returns is a vector(I think), but how can I get the certain component of this vector? e.g. the first component of it.
I tried points.component(vector::X)[0], points.component(vector::X).value(0), points.component(vector::X).component(0). But none of them works.

Does anyone has an idea? I'd be very appreciate for your answer!

Best regards
Gerwang
Gerwang is offline   Reply With Quote

Old   January 11, 2016, 07:18
Default
  #2
New Member
 
Chengyu Wang
Join Date: Dec 2015
Posts: 7
Rep Power: 10
Gerwang is on a distinguished road
I figured out one way to do it, and now it works, just use:
Code:
points[0].component(vector::X)
Quote:
Originally Posted by Gerwang View Post
Hello Foamers!

I'm trying to modify decompose method, for which I need to get the x component of a point.

A series of points is defined like this:
Code:
pointField points
There is a way to get the value of its X component and it works like this:
Code:
points.component(vector::X)
What this returns is a vector(I think), but how can I get the certain component of this vector? e.g. the first component of it.
I tried points.component(vector::X)[0], points.component(vector::X).value(0), points.component(vector::X).component(0). But none of them works.

Does anyone has an idea? I'd be very appreciate for your answer!

Best regards
Gerwang
Gerwang is offline   Reply With Quote

Reply

Tags
coordinate of points, pointfiels

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
UDF for searching the closest point to a certain point princekar Fluent UDF and Scheme Programming 2 April 26, 2015 04:53
block-structured mesh for t-junction Robert@cfd ANSYS Meshing & Geometry 20 November 11, 2011 04:59
Problem with UDF compiling for kTkLW model Wantami FLUENT 0 July 18, 2011 05:11
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 15:28
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 12:20


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