CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

macro expansion within codeStream for boundary.findPatchID()

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

LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2018, 03:33
Default macro expansion within codeStream for boundary.findPatchID()
Join Date: Feb 2016
Posts: 48
Rep Power: 10
PanPeter is on a distinguished road
Hello together,

I am using the macro expansion functionality to dynamically set the names for my boundary patches. Now I implement a code stream on a boundary patch. To access the mesh data on the respective patch I use mesh.boundary.findPatchID("patchName"). And here I don't find a way to replace patchName with my marco expansion. It seems the parentheses are not compatible with the macro expansion.

Does anybody have an idea as how to solve this or could suggest a work-around?

    OUTLET_NAME		outlet;
#inlcude "../patchNames.h"
type fixedValue; value #codeStream {
... ... code #{
... ... ... // this is where I want to use my macro expansion instead of writing "outlet" out: const label id = mesh.boundary().findPatchID("outlet"); ...
PanPeter is offline   Reply With Quote

Old   December 15, 2022, 21:17
Ali B.
Join Date: Mar 2020
Posts: 34
Rep Power: 6
reverseila is on a distinguished road
It is probably late...

You can access a dictionary name by simply using the dictName member function

const word patchName = dict.dictName();
const label id = mesh.boundary().findPatchID(patchName);
If you take a look at the dictionary class, there are two member functions, name() and dictName()

        //- The dictionary name
        inline const fileName& name() const noexcept;

        //- The dictionary name for modification (use with caution).
        inline fileName& name() noexcept;

        //- The local dictionary name (final part of scoped name)
        inline word dictName() const;
The name() member function returns a so called "scoped name"

But the dictName() returns the (sub)dictionary name...

reverseila is offline   Reply With Quote


code stream, macro expansion

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
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 14:43
timestep extraction for macro manuc Tecplot 0 August 10, 2016 12:20
Error in compiling new drag model k.farnagh OpenFOAM Programming & Development 13 May 21, 2016 03:08
Add New Pyrolysis Chemistry Type LWhitson2 OpenFOAM Programming & Development 0 April 30, 2015 18:54
Macro problem cfddummy Siemens 1 April 9, 2007 12:37

All times are GMT -4. The time now is 22:53.