Fixing gcc 3.3 compile failures -- fix for math/freefem
Simon Barner
barner at in.tum.de
Fri Jul 18 20:05:42 PDT 2003
--- freefem/fem/femDisk.cpp.orig Sat Jul 19 04:09:32 2003
+++ freefem/fem/femDisk.cpp Sat Jul 19 04:13:43 2003
@@ -95,7 +95,7 @@
char *result = 0;
int dummy;
- ifstream fin( path );
+ std::ifstream fin( path );
if ( fin.fail() )
{
@@ -198,7 +198,7 @@
int i;
char *result = NULL;
- ofstream fout( path );
+ std::ofstream fout( path );
if ( fout.fail() )
{
@@ -210,11 +210,11 @@
*/
if ((result = strstr (path,".amdba")) != NULL) /* amdba format */
{
- fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() << endl;
+ fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() << std::endl;
for (i = 0; i < t->getNumberOfPoints(); i++)
{
- fout << i+1 << " " << t->rp[i][0] << " " << t->rp[i][1] << " " << t->ng[i] << endl;
+ fout << i+1 << " " << t->rp[i][0] << " " << t->rp[i][1] << " " << t->ng[i] << std::endl;
}
@@ -224,13 +224,13 @@
<< " " << t->tr[i][0]+1
<< " " << t->tr[i][1]+1
<< " " << t->tr[i][2]+1
- << " " << t->ngt[i] << endl;
+ << " " << t->ngt[i] << std::endl;
}
}
else if ((result = strstr (path,".am_fmt")) != NULL)/* am_fmt format */
{
#if 0
- fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() < endl;
+ fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() < std::endl;
dummy = 0;
for (i = 0; i < t->getNumberOfCells(); i++)
@@ -238,39 +238,39 @@
fout << t->tr[i][0]+1
<< " " << t->tr[i][1]+1
<< " " << t->tr[i][2]+1
- << endl;
+ << std::endl;
END_OF_LINE(data, dummy, 1);
}
if (dummy) fprintf(data,"\n");
dummy = 0;
for (i = 0; i < t->getNumberOfPoints(); i++)
{
- fout << t->rp[i][0] << " " << t->rp[i][1] << endl;
+ fout << t->rp[i][0] << " " << t->rp[i][1] << std::endl;
END_OF_LINE (data, dummy, 1);
}
if (dummy) fprintf(data,"\n");
dummy = 0;
for (i = 0; i < t->getNumberOfCells(); i++)
{
- fout << t->ngt[i] << endl;
+ fout << t->ngt[i] << std::endl;
END_OF_LINE (data, dummy, 9);
}
if (dummy) fprintf(data,"\n");
dummy = 0;
for (i = 0; i < t->getNumberOfPoints(); i++)
{
- fout << t->ng[i] << endl;
+ fout << t->ng[i] << std::endl;
END_OF_LINE (data, dummy, 9);
}
#endif
}
else
{
- fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() << endl;
+ fout << t->getNumberOfPoints() << " " << t->getNumberOfCells() << std::endl;
for (i = 0; i < t->getNumberOfPoints(); i++)
{
- fout << t->rp[i][0] << " " << t->rp[i][1] << " " << t->ng[i] << endl;
+ fout << t->rp[i][0] << " " << t->rp[i][1] << " " << t->ng[i] << std::endl;
}
@@ -279,7 +279,7 @@
fout << t->tr[i][0]+1
<< " " << t->tr[i][1]+1
<< " " << t->tr[i][2]+1
- << " " << t->ngt[i] << endl;
+ << " " << t->ngt[i] << std::endl;
}
}
return 0;
@@ -317,9 +317,9 @@
saveparam (fcts * param, femMesh * t, char *path, int N)
{
int k, ns = t->getNumberOfPoints();
- ofstream file (path);
+ std::ofstream file (path);
file.precision (8);
- file << ns << " " << N << endl;
+ file << ns << " " << N << std::endl;
for (k = 0; k < ns; k++)
{
if (N == 1)
@@ -373,7 +373,7 @@
file << (param)->nuyy2[k] << " ";
file << " ";
}
- file << endl;
+ file << std::endl;
}
file.close ();
return 0;
@@ -383,9 +383,9 @@
int
saveconst (creal f, char *path)
{
- ofstream file (path, ios::out | ios::app);
- // file.seekoff(0,ios::end,0);
- file << f << endl;
+ std::ofstream file (path, std::ios::out | std::ios::app);
+ // file.seekoff(0,std::ios::end,0);
+ file << f << std::endl;
file.close ();
return 0;
}
-------------- next part --------------
--- freefem/fem/femGibbs.cpp.orig Sat Jul 19 04:10:36 2003
+++ freefem/fem/femGibbs.cpp Sat Jul 19 04:19:02 2003
@@ -38,6 +38,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
//
// Freefem includes
@@ -1173,9 +1174,9 @@
{
f = new femPoint[ns];
for (i = 0; i < ns; ++i)
- f[i] = rp[i];
+ memcpy (f[i], rp[i], sizeof (femPoint));
for (i = 0; i < ns; ++i)
- rp[r[i] - 1] = f[i];
+ memcpy (rp[r[i] - 1], f[i], sizeof (femPoint));
for (j = 0; j < nt; ++j)
for (i = 0; i < 3; i++)
-------------- next part --------------
--- freefem/fem/femGraphicX11.cpp.orig Sat Jul 19 04:10:02 2003
+++ freefem/fem/femGraphicX11.cpp Sat Jul 19 04:12:31 2003
@@ -118,7 +118,7 @@
void
out_of_memory ()
{
- cerr << "FreeFEM error: operator new failed; not enough memory" << endl;
+ std::cerr << "FreeFEM error: operator new failed; not enough memory" << std::endl;
exit (-1);
}
-------------- next part --------------
--- freefem/fem/femMisc.cpp.orig Sat Jul 19 04:09:41 2003
+++ freefem/fem/femMisc.cpp Sat Jul 19 04:12:31 2003
@@ -70,24 +70,24 @@
return a;
}
-ostream & operator << (ostream & os, const Complex & a)
+std::ostream & operator << (std::ostream & os, const Complex & a)
{
os << a.re << " " << a.im << " ";
return os;
}
-istream & operator >> (istream & os, Complex & a)
+std::istream & operator >> (std::istream & os, Complex & a)
{
os >> a.re >> a.im;
return os;
}
-ostream & operator << (ostream & os, cvect & a)
+std::ostream & operator << (std::ostream & os, cvect & a)
{
for (int i = 0; i < N; i++)
os << a[i] << " ";
return os;
}
-ostream & operator << (ostream & os, cmat & a)
+std::ostream & operator << (std::ostream & os, cmat & a)
{
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
-------------- next part --------------
--- freefem/fem/femParser.cpp.orig Sat Jul 19 04:09:53 2003
+++ freefem/fem/femParser.cpp Sat Jul 19 04:35:15 2003
@@ -1168,9 +1168,9 @@
if (cursym == oldvar)
{
thecst = 1.F;
- ofstream file (thechaine);
+ std::ofstream file (thechaine);
- file << ' ' << endl;
+ file << ' ' << std::endl;
file.close ();
} // clean the file
else
@@ -2539,7 +2539,7 @@
#if defined(DEBUG)
- cerr << "adaptation process called" << endl;
+ std::cerr << "adaptation process called" << std::endl;
#endif
nsol = 4;
@@ -2553,7 +2553,7 @@
nsol = 3;
#if defined(DEBUG)
- cerr << " nsol = " << nsol << endl;
+ std::cerr << " nsol = " << nsol << std::endl;
#endif /* DEBUG */
/*
@@ -2614,10 +2614,10 @@
#endif /* not NOXGFEM */
#ifdef DEBUG
- cout<<adapt_param<<endl;
+ std::cout<<adapt_param<<std::endl;
#endif /* DEBUG */
#if defined(DEBUG)
- cerr << "creating the solution" << endl;
+ std::cerr << "creating the solution" << std::endl;
#endif /* DEBUG */
solution = new Scalar[nsol*__mesh.getNumberOfPoints()];
for (s = 1;s <= nsol;s++)
@@ -2646,12 +2646,12 @@
solution[nsol*iglob+3] = realpart (eval(l4));
}
#if defined(DEBUG)
- cerr << "Done" << endl;
+ std::cerr << "Done" << std::endl;
#endif /* DEBUG */
#if defined(DEBUG)
- ofstream fsol("sol.bb");
- fsol << 3 << " " << nsol << " " << __mesh.getNumberOfPoints() << " " << 2 << endl;
+ std::ofstream fsol("sol.bb");
+ fsol << 3 << " " << nsol << " " << __mesh.getNumberOfPoints() << " " << 2 << std::endl;
for (i = 0;i < __mesh.getNumberOfPoints();i++)
{
fsol << solution[nsol*i] << " ";
@@ -2661,7 +2661,7 @@
fsol << solution[nsol*i+2] << " ";
if (nsol == 4)
fsol << solution[nsol*i+3];
- fsol << endl;
+ fsol << std::endl;
}
fsol.close ();
#endif /* DEBUG */
@@ -2681,9 +2681,9 @@
* ATTENTION, IMPOSING NGT[I]=0
*/
#if defined(DEBUG)
- cout<<"===================================================="<<endl;
- cout<<" IMPOSING NGT[I]=0"<<endl;
- cout<<"===================================================="<<endl;
+ std::cout<<"===================================================="<<std::endl;
+ std::cout<<" IMPOSING NGT[I]=0"<<std::endl;
+ std::cout<<"===================================================="<<std::endl;
#endif /* DEBUG */
for (i=0;i<__mesh.getNumberOfCells(); i++) {__mesh.ngt[i]=0;};
@@ -2708,9 +2708,9 @@
if (tiempo==NIL) ERROR();
the_clock(tiempo);
#ifdef DEBUG
- cout<<"================================================="<<endl;
- cout<<" METRIC COMPUTATION"<<endl;
- cout<<"================================================="<<endl;
+ std::cout<<"================================================="<<std::endl;
+ std::cout<<" METRIC COMPUTATION"<<std::endl;
+ std::cout<<"================================================="<<std::endl;
#endif
if (adapt_param.sol==1) {
cal_metrica(malla,solution,malla->m,adapt_param.aniso,adapt_param.err0,adapt_param.lmax,adapt_param.lmin,adapt_param.nsol,adapt_param.refwall,adapt_param.hwall,malla->factr(),adapt_param.nbt_max);
@@ -2723,15 +2723,15 @@
}
#ifdef DEBUG
the_clock(tiempo);
- cout<<"--------------------------------------------------------"<<endl;
- cout<<"Metric computation time :"<<*tiempo<<endl;
- cout<<"--------------------------------------------------------"<<endl;
+ std::cout<<"--------------------------------------------------------"<<std::endl;
+ std::cout<<"Metric computation time :"<<*tiempo<<std::endl;
+ std::cout<<"--------------------------------------------------------"<<std::endl;
#endif /* DEBUG */
// CAD definition from __mesh.
#if defined(DEBUG)
- cerr << "adapt angulo:" << adapt_param.angulo << endl
- << "factor: " << malla->factr() << endl;
+ std::cerr << "adapt angulo:" << adapt_param.angulo << std::endl
+ << "factor: " << malla->factr() << std::endl;
#endif /* DEBUG */
//cad=build(t_cad,adapt_param.angulo,malla->factr());
delete t_cad;
@@ -2759,24 +2759,24 @@
}
#ifdef DEBUG
- cout<<"================================================="<<endl;
- cout<<" MESH ADAPTATION"<<endl;
- cout<<"================================================="<<endl;
+ std::cout<<"================================================="<<std::endl;
+ std::cout<<" MESH ADAPTATION"<<std::endl;
+ std::cout<<"================================================="<<std::endl;
#endif /* DEBUG */
t_fin=regenera_malla(malla,solution,adapt_param.timesh,adapt_param.sol,adapt_param.nsol,adapt_param.sol_interp,adapt_param.angulo,adapt_param.nit,adapt_param.segur,tiempo,adapt_param.reg_ini,adapt_param.reg_fin,adapt_param.rel_mtr,adapt_param.fluid_NS,adapt_param.hwall,adapt_param.refwall,cad,adapt_param.tinterp,sol_interp, func, nfunc, &interp_func);
the_clock(tiempo);
#ifdef DEBUG
- cout<<"------------------------------------------------------------"<<endl;
- cout<<"Global time: Metric computation+mesh adaptation:"<<*tiempo<<endl;
- cout<<"------------------------------------------------------------"<<endl;
+ std::cout<<"------------------------------------------------------------"<<std::endl;
+ std::cout<<"Global time: Metric computation+mesh adaptation:"<<*tiempo<<std::endl;
+ std::cout<<"------------------------------------------------------------"<<std::endl;
#endif /* DEBUG */
delete tiempo;
#ifdef DEBUG
- cout<<"============================================================="<<endl;
- cout<<" FEMMESH ACTUALIZATION"<<endl;
- cout<<"============================================================="<<endl;
+ std::cout<<"============================================================="<<std::endl;
+ std::cout<<" FEMMESH ACTUALIZATION"<<std::endl;
+ std::cout<<"============================================================="<<std::endl;
#endif /* DEBUG */
__mesh.set( t_fin->np, t_fin->nt );
@@ -2796,7 +2796,7 @@
__mesh.removeBdyT();
#if defined(DEBUG)
- cerr << "Done" << endl;
+ std::cerr << "Done" << std::endl;
#endif /* DEBUG */
/*
@@ -2808,7 +2808,7 @@
* Update the table of functions
*/
#if defined(DEBUG)
- cerr << "Updating the table of functions:" << __mesh.getNumberOfPoints() << endl;
+ std::cerr << "Updating the table of functions:" << __mesh.getNumberOfPoints() << std::endl;
#endif /* DEBUG */
if (nfunc > 0)
{
@@ -2828,7 +2828,7 @@
delete [] interp_func;
}
#if defined(DEBUG)
- cerr << "Done update function table" << endl;
+ std::cerr << "Done update function table" << std::endl;
#endif /* DEBUG */
delete t_fin;
@@ -2838,7 +2838,7 @@
delete cad;
#if defined(DEBUG)
- cerr << "Done adaptation" << endl;
+ std::cerr << "Done adaptation" << std::endl;
#endif /* DEBUG */
#endif /* ADAPT */
@@ -3412,18 +3412,18 @@
void
femParser::showident (ident * i)
{
- cerr << i->name << "\n";
+ std::cerr << i->name << "\n";
}
void
femParser::showtreeaux (int level, noeudPtr t)
{
// blanks (level);
- cerr << mesg[t->symb] << " " << (int)t->symb << "\n";
+ std::cerr << mesg[t->symb] << " " << (int)t->symb << "\n";
if (realpart (t->value))
{
// blanks (level + 1);
- cerr << realpart (t->value) << "\n";
+ std::cerr << realpart (t->value) << "\n";
}
if (t->name)
{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: Digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20030719/e3570e49/attachment.bin
More information about the freebsd-current
mailing list