--- trunk/SHAPES/SphereHarm.cpp 2004/06/25 20:10:53 1309 +++ trunk/SHAPES/SphereHarm.cpp 2004/07/20 20:02:15 1360 @@ -111,7 +111,12 @@ void SphereHarm::printShapesFileStart(char name[200], void SphereHarm::printShapesFileStart(char name[200], char particle[80], double mass, double momInert[3][3]){ - ofstream shapes(name); + ofstream myShapes(name); + printShapesStreamStart(myShapes, particle, mass, momInert); +} + +void SphereHarm::printShapesStreamStart(ostream& shapes, char particle[80], + double mass, double momInert[3][3]){ shapes << "begin ShapeInfo\n"; shapes << "#name\t\tmass\tI_xx\tI_yy\tI_zz\n"; shapes << particle << "\t" << mass << "\t" << momInert[0][0] << "\t" @@ -119,8 +124,15 @@ void SphereHarm::printToShapesFile(char name[200], int shapes << "end ShapeInfo\n"; } -void SphereHarm::printToShapesFile(char name[200], int index){ + + +void SphereHarm::printToShapesFile(char name[200], int index, double tolVal){ ofstream shapes(name, ios::app); + + printToShapesStream(shapes, index, tolVal); +} + +void SphereHarm::printToShapesStream(ostream& shapes, int index, double tolVal) { biggest = 0.0; nfuncs = 0; @@ -158,8 +170,8 @@ void SphereHarm::printToShapesFile(char name[200], int - icoeffs[dummy2]); } - if (fabs(cm) > 0.01 * biggest) nfuncs++; - if (fabs(sm) > 0.01 * biggest) nfuncs++; + if (fabs(cm) > tolVal * biggest) nfuncs++; + if (fabs(sm) > tolVal * biggest) nfuncs++; } } @@ -193,9 +205,9 @@ void SphereHarm::printToShapesFile(char name[200], int - icoeffs[dummy2]); } - if (fabs(cm) > 0.01 * biggest) + if (fabs(cm) > tolVal * biggest) shapes << l << "\t" << m << "\tcos\t\t" << cm << "\n"; - if (fabs(sm) > 0.01 * biggest) + if (fabs(sm) > tolVal * biggest) shapes << l << "\t" << m << "\tsin\t\t" << sm << "\n"; } }