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

Initializing dimensionedtypes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2018, 08:39
Default Initializing dimensionedtypes
  #1
Member
 
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11
vkoppejan is on a distinguished road
Hi Everyone,

I work a lot with vectorList and scalarList and I would like to replace them by their dimensioned version, so List<dimensionedVector> and List<dimensionedScalar>.

At the moment I declare the lists in the headerfile but this is a problem for the dimensioned versions.

Declaring:
Code:
List<dimensionedVector>
uses the constructor below

Code:
template<class Type>
Foam::dimensioned<Type>::dimensioned
()
:
    name_("undefined"),
    dimensions_(dimless),
    value_(pTraits<Type>::zero)
{}
How can I make it use one of the other constructors, preferably

Code:
template<class Type>
Foam::dimensioned<Type>::dimensioned
(
    const word& name,
    const dimensionSet& dimSet,
    const Type t
)
:
    name_(name),
    dimensions_(dimSet),
    value_(t)
{}
Thanks in advance,

Victor
vkoppejan is offline   Reply With Quote

Old   February 12, 2020, 12:46
Default
  #2
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 57
Rep Power: 9
Diro7 is on a distinguished road
Hi Victor!

I guess I'm experiencing the same kind of trouble, as I'm not able to declare a List<dimensionedScalar> without having it initialized with the null constructor, which then prevents me to assign to the list elements with different dimensions.

After all this time, did you manage to solve your problem?

Andrea
Diro7 is offline   Reply With Quote

Old   February 16, 2020, 04:34
Default
  #3
Member
 
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11
vkoppejan is on a distinguished road
Hi, sorry for the late reply. I didn't find a solution.
vkoppejan is offline   Reply With Quote

Old   August 6, 2023, 18:25
Default
  #4
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Quote:
Originally Posted by Diro7 View Post
Hi Victor!

I guess I'm experiencing the same kind of trouble, as I'm not able to declare a List<dimensionedScalar> without having it initialized with the null constructor, which then prevents me to assign to the list elements with different dimensions.

After all this time, did you manage to solve your problem?

Andrea

I do not know if it helps but I create the list of 10 dimensioned scalars
with value 0 like this in the constructor

Code:
    myListDS_{List<dimensionedScalar>(10, dimensionedScalar(dimLength, 0).value())}
It compiles. However, if I do not have
Code:
value()
method I get the error of different dimensions in OF case.
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Reply


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
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 08:31
Initializing large models mahmoudtmt FLUENT 3 July 16, 2017 23:35
ignorance the initializing sinatahmooresi OpenFOAM Running, Solving & CFD 0 May 22, 2016 07:13
Initializing or patching cell zones kozalp FLUENT 0 December 30, 2013 17:00
query regarding role of initializing in a solving Kishore FLUENT 2 July 5, 2007 00:23


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