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 Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2016, 07:53
Question How to get the x component of a point?
  #1
New Member
 
Chengyu Wang
Join Date: Dec 2015
Posts: 7
Rep Power: 11
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, 08:18
Default
  #2
New Member
 
Chengyu Wang
Join Date: Dec 2015
Posts: 7
Rep Power: 11
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


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 05:53
block-structured mesh for t-junction Robert@cfd ANSYS Meshing & Geometry 20 November 11, 2011 05:59
Problem with UDF compiling for kTkLW model Wantami FLUENT 0 July 18, 2011 06:11
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 16:28
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 13:20


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