CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

cast vector to Type

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

LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2012, 04:42
Default cast vector to Type
New Member
Jordi Muela
Join Date: Mar 2011
Posts: 27
Rep Power: 15
jordi.muela is on a distinguished road
Hi all,

I'm modifying a boundary condition and I need to know how to cast a vector to Type, which is the type that I need to assign... I'm going to try explain it better:

the original boundary condition has:

and I know that timeSeries_(this->db().time().timeOutputValue()) returns Type. So I made a new function:

template<class Type>
Type Foam::timeVaryingSocketValuePointPatchField<Type>::recvSocketPos()
and I change the original line for:

Ok, now inside my new function recvSocketPos() I know that the info that i must return is a vector with the postion of the boundary, for example:

vector pos(x, y, z);
but of course I can't compile with:

I must cast in some way the pos vector to another var like Type vectorType, cause if i put in my code:

Type vectorType;
It compiles, but I can't find the way to cast a type to another. I tried many ways, for example, I thought that vector was a derived class of Type, so I tested:

Type *pType;	
pType = new(vector);
which is the usual way that i use in C++ when I have to use a class but I can't know it before compilation, only in runtime.

So please!! What's the way in OpenFOAM?? What are the relation between Type and vector classes?? Aren't parent and child respectively?

Lot of thanks in advance!!
jordi.muela is offline   Reply With Quote


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
singularity? mihaipruna OpenFOAM Running, Solving & CFD 5 April 24, 2012 18:18
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 18:08
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50

All times are GMT -4. The time now is 04:34.