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

Questions about createFvOptions.H

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 23, 2021, 16:26
Default Questions about createFvOptions.H
  #1
New Member
 
Jiaqi Chen
Join Date: Aug 2021
Posts: 2
Rep Power: 0
silentinside is on a distinguished road
Hi guys, I'm kind of new to OpenFoam and C++. I'm trying to understand how a solver generally "works", and I'm a bit confused by something here.

In createFvOptions.H, there is the initialization of a fv:: option object as:

Code:
fv::options& fvOptions(fv::options::New(mesh));
The fv:: options::New(mesh) returns a reference to a newly created fv:: option object, and if I'm understanding correctly, this is suppose to be a copy construct. However, in the definition of fv:: options in fvOptions.H, the copy constructor is deleted as:

Code:
options(const options&) = delete;
So I clearly misunderstand sth. here since the solver works fine.
silentinside is offline   Reply With Quote

Old   August 27, 2021, 15:31
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
In your code
Code:
fv::options& fvOptions(fv::options::New(mesh));
fv:: options::New(mesh) returns a reference to the object (not the object itself). This reference is copied into fvOptions (not the object inself). Copy constructor of fv:: options isn't invoked here.
Zeppo is offline   Reply With Quote

Old   August 29, 2021, 16:47
Default
  #3
New Member
 
Jiaqi Chen
Join Date: Aug 2021
Posts: 2
Rep Power: 0
silentinside is on a distinguished road
Quote:
Originally Posted by Zeppo View Post
In your code
Code:
fv::options& fvOptions(fv::options::New(mesh));
fv:: options::New(mesh) returns a reference to the object (not the object itself). This reference is copied into fvOptions (not the object inself). Copy constructor of fv:: options isn't invoked here.
Thanks a lot! I was being stupid.....
silentinside 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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
[ICEM] Complex geometry mesh general questions Jack B ANSYS Meshing & Geometry 0 August 14, 2019 13:44
General questions about how to mesh and build up my case ThunderstruckGER OpenFOAM 5 September 23, 2018 18:33
possible interview questions atturh Main CFD Forum 1 February 21, 2012 08:53
NACA0012 Validation Case Questions ozzythewise Main CFD Forum 3 August 3, 2010 14:39


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