CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM

How to define the list of vector when a vector has n components

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

LinkBack Thread Tools Display Modes
Old   October 26, 2012, 00:58
Default How to define the list of vector when a vector has n components
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 217
Blog Entries: 1
Rep Power: 11
fumiya is on a distinguished road

I can define the list of vector by the following
when a vector has "three" components:

label Np = mesh.points().size();
List<vector> N(Np, vector::zero);

What should I do if I want to define the list of
vector when a vector has "n" components(n: positive integer)?

Best regards,
fumiya is online now   Reply With Quote

Old   October 26, 2012, 04:10
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,759
Rep Power: 29
ngj will become famous soon enoughngj will become famous soon enough
Good morning Fumiya

You could do the following

List<scalarField> var( size_0 );

forAll( var, vari )
    scalarField & v( var[vari] );
    v.setSize( size_1, 0.0);

    // Fill the scalarField with its content
You could also do the same with vectorField, tensorField, pointField, labelList, etc.

Kind regards,

ngj is offline   Reply With Quote


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
Robin B.C. Yu FLUENT 3 May 27, 2012 04:19
ACCESS VIOLATION MHDWill FLUENT 1 September 23, 2007 02:51
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 10:19

All times are GMT -4. The time now is 11:38.