|
[Sponsors] |
January 17, 2008, 05:50 |
How can I export a variable pr
|
#1 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
How can I export a variable profile on a boundary patch ?
|
|
January 22, 2008, 08:45 |
More precisely, how can I expo
|
#2 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
More precisely, how can I export the content of a fvPatchField (either <double> or vector<double>) to a file ?
|
|
January 23, 2008, 07:54 |
To better understand how class
|
#3 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
To better understand how classes work, I tried to play a little. What I do not understand is why this code :
List<scalar> a(10); a=2; List<scalar> b(10); b=3; List<scalar> c=a+b; Info << "c(1) = " << c[1] << endl; gives the result c(1) = 5 since in the member functions of List I can not find the operator + |
|
January 23, 2008, 08:30 |
Not sure what else you have ex
|
#4 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
Not sure what else you have expected: 2 + 3 = 5.
Here, you created 2 lists of size 10, then assigned all elements of first list to 2 and all elements of the second list to 3 and summed them up. The actual operator+(...) you are using is: template<class> tmp<field<typename>::type> > operator Op(const UList<type1>& f1, const UList<type2>& f2); in /home/hjasak/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/fields/Fields/Field/FieldF unctions.H Beware of the macros... Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
January 25, 2008, 05:17 |
Why are some operators impleme
|
#5 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Why are some operators implemented via member functions and others via macros ? It seems to me that macros are harder to find in the documentation ?
|
|
January 25, 2008, 05:27 |
Because of code re-use and con
|
#6 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
Because of code re-use and consistency. Templates, (of course, you mean templates! rather than member functions) are preferred whenever possible - in fact you will see that the macro I've showed you actually defines a template.
Other possible question you may be asking is why is eg. operator+= a member and operator+ a friend. There are VERY good reasons for it, to do with automatic type conversion on the rhs argument. A good C++ book will tell you why. Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP NEEDED HOW TO MAP VALUES FROM PATCH OF ONE MESH TO PATCH OF ANOTHER MESH | mkraposhin | OpenFOAM Running, Solving & CFD | 3 | September 4, 2011 10:42 |
SampleDict patch export surface size amp orientation | axel | OpenFOAM Post-Processing | 1 | September 29, 2008 14:42 |
Patch mesh export | ariorus | OpenFOAM | 3 | March 7, 2006 06:41 |
about patch | ZQX | FLUENT | 1 | October 14, 2005 05:54 |
Boundary profile export each iteration | Jiri Novak | FLUENT | 2 | July 27, 2005 04:19 |