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

Faked mesh for internal program use

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wouter

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 1, 2017, 15:47
Default Faked mesh for internal program use
  #1
Member
 
Join Date: Aug 2015
Posts: 37
Rep Power: 10
knuckles is on a distinguished road
Background: there is a function I'm interested in reusing which takes the form

Code:
 tmp<volScalarField> foo(const volScalarField& arg);
...where the implementation sets each entry in the result based on the corresponding entry in arg only. I would like to apply this same operation to a single value but don't want to re-code foo. If I could create a fake internal mesh with exactly one entry, then I could pass this mesh to the volScalarField constructor and create a volScalarField with exactly one entry, which I could pass too foo. I could then extract the result I'm interested in from the single-valued result.

Is this possible? Is there another workaround?
knuckles is offline   Reply With Quote

Old   February 2, 2017, 01:52
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hello,

I really do not get the point you want to do? Why you want to build a volScalarField with a single entry. Do it with a dimensionedScalar or just a scalar. Provide more information and you will see that we can help you. With the lack of information, it is not really understandable; especially for people who are not sitting in front of your computer and are not related to the things you do.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 2, 2017, 14:55
Default
  #3
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
hello knuckles,

I totaly agree with Tobi, I have no clue what you want. But what I think is that you need to take a look at C++ templates, widely used in OpenFoam. This gives you the possibility to use the same function with different kind of arguments

Hope this helps,
Wouter
Tobi likes this.
wouter 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
[snappyHexMesh] SHM problem : KVLCC2 with appendage mesh sc.park OpenFOAM Meshing & Mesh Conversion 1 March 13, 2016 13:28
[snappyHexMesh] SnappyHexMesh no layers and no decent mesh for complex geometry pizzaspinate OpenFOAM Meshing & Mesh Conversion 1 February 25, 2015 07:05
[snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 09:03
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55


All times are GMT -4. The time now is 13:21.