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

FOR_ALL_FIELD_TYPES in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2023, 06:19
Default FOR_ALL_FIELD_TYPES in OpenFOAM
  #1
New Member
 
do
Join Date: Jan 2023
Posts: 1
Rep Power: 0
Golden is on a distinguished road
Hi, formers,

I'm trying to understand what does "FOR_ALL_FIELD_TYPES" function do in source codes in OpenFOAM.

I have found this function at "fieldTypes.H"
and its definition is written below:

Code:
Description
    Include the header files for all the primitive types that Fields are
    instantiated for.

\*---------------------------------------------------------------------------*/

#ifndef fieldTypes_H
#define fieldTypes_H

#include "label.H"
#include "scalar.H"
#include "vector.H"
#include "sphericalTensor.H"
#include "symmTensor.H"
#include "tensor.H"
#include "triad.H"
#include "macros.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#define CAPITALIZE_scalar Scalar
#define CAPITALIZE_vector Vector
#define CAPITALIZE_sphericalTensor SphericalTensor
#define CAPITALIZE_symmTensor SymmTensor
#define CAPITALIZE_tensor Tensor

#define FOR_ALL_FIELD_TYPES(Macro, ...)                                        \
    Macro(scalar, __VA_ARGS__)                                                 \
    Macro(vector, __VA_ARGS__)                                                 \
    Macro(sphericalTensor, __VA_ARGS__)                                        \
    Macro(symmTensor, __VA_ARGS__)                                             \
    Macro(tensor, __VA_ARGS__)

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
What really makes me mazed is "Macro" function used in the definition of "FOR_ALL_FIELD_TYPES" .
I tried to search what does "Macro" means with grep utility, but i have not found anything helpful.

Does anyone knows anything about those "FOR_ALL_FIELD_TYPES" and "Macro" functions?
Golden is offline   Reply With Quote

Old   September 25, 2023, 17:14
Default
  #2
New Member
 
Liu Yajing
Join Date: Apr 2022
Posts: 4
Rep Power: 4
zjuliu is on a distinguished road
My understanding. According to the Macro syntax, ‘Macro’ is the first parameter of FOR_ALL_TYPE_FIELD, which is also a function name because it puts before (). For example, the 'Macro' is 'makePatchFieldTypeName', then FOR_ALL_TYPE_FIELD means makePatchFieldTypeName(scalar, __VA_ARGS__)
makePatchFieldTypeName(vector, __VA_ARGS__) ...
zjuliu 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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
How to develop OpenFOAM with CMake and popular IDEs cosscholar OpenFOAM Programming & Development 0 March 16, 2022 15:17
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


All times are GMT -4. The time now is 06:46.