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

Compiling modified patchAverage tool

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2009, 11:40
Default Compiling modified patchAverage tool
  #1
Bjw
New Member
 
Björn Westendorf
Join Date: Oct 2009
Location: Stuttgart, Germany
Posts: 9
Rep Power: 17
Bjw is on a distinguished road
I'm trying to modify the patchAverage tool, so that the calculation result will be written into a simple text file. In a simple C++ app, including

Code:
#include <iostream>
#include <fstream>
and adding the following simple code:

Code:
ofstream results;
results.open ("results.dat", ios::out | ios::app);
results<< sumField << endl;
results.close;
should do the job. Howewer, I cannot compile that tool. wmake will produce the following:
Code:
Making dependency list for source file patchAverageToFile.C
SOURCE=patchAverageToFile.C ;  g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3  -DNoRepository -ftemplate-depth-40 -I/home/stss2/OpenFOAM/OpenFOAM-1.5.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/stss2/OpenFOAM/OpenFOAM-1.5.x/src/OpenFOAM/lnInclude -I/home/stss2/OpenFOAM/OpenFOAM-1.5.x/src/OSspecific/Unix/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/patchAverageToFile.o
patchAverageToFile.C: In function ‘int main(int, char**)’:
patchAverageToFile.C:96: error: ‘ofstream’ was not declared in this scope
patchAverageToFile.C:96: error: expected `;' before ‘results’
patchAverageToFile.C:97: error: ‘results’ was not declared in this scope
patchAverageToFile.C:97: error: ‘ios’ has not been declared
patchAverageToFile.C:97: error: ‘ios’ has not been declared
make: *** [Make/linux64GccDPOpt/patchAverageToFile.o] Fehler 1
Can somebody tell me how to fix that?

Thanks, Björn
Bjw is offline   Reply With Quote

Old   October 16, 2009, 01:10
Default what's your object ?
  #2
Member
 
jingjing
Join Date: Mar 2009
Location: shanghai,China
Posts: 30
Rep Power: 17
zhajingjing is on a distinguished road
what's the object of your modified patchAverage file? the original patchAverage tool already has the ability to produce data.If you want to get a data file,you just run the tool,

just like this: patchAverage fieldName patchName > dataFileName

then you can get the data file

So I don't know your real object.If the object is just to get a data file,you can do as above,


jingjing
zhajingjing is offline   Reply With Quote

Old   October 16, 2009, 05:37
Default
  #3
Bjw
New Member
 
Björn Westendorf
Join Date: Oct 2009
Location: Stuttgart, Germany
Posts: 9
Rep Power: 17
Bjw is on a distinguished road
Well, I need to parse the calculation result with another application for automated post-processing. So it would be nice to just write out the result rather than writing the whole screen output to file.
Bjw is offline   Reply With Quote

Old   October 16, 2009, 05:47
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Try sticking 'std::' in front of ofstream, or 'using namespace std' before main.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   October 16, 2009, 06:31
Default
  #5
Bjw
New Member
 
Björn Westendorf
Join Date: Oct 2009
Location: Stuttgart, Germany
Posts: 9
Rep Power: 17
Bjw is on a distinguished road
Great, that worked, thank you very much! ofstream and ios are obviously not declared in the foam namespace.
Bjw is offline   Reply With Quote

Reply

Tags
compile, patchaverage


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
Problems while using the sample post-procesing tool svens OpenFOAM Post-Processing 5 September 2, 2010 12:13
[mesh manipulation] ScalePoints tool cedric_duprat OpenFOAM Meshing & Mesh Conversion 6 September 19, 2008 04:15
tool for approximation of condition number rt Main CFD Forum 6 June 24, 2006 03:42
Parametrical tool? Renaud FLUENT 0 May 25, 2006 05:51
Modified Equation for CFX algorithm Craig Johansen CFX 0 August 28, 2004 00:02


All times are GMT -4. The time now is 14:34.