Changes in / [6d4a76:23e09b]
- Location:
- src
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r6d4a76 r23e09b 2 2 #include "boundary.hpp" 3 3 4 #define DEBUG 1 5 #define DoTecplotOutput 0 6 #define DoRaster3DOutput 1 7 #define TecplotSuffix ".dat" 8 #define Raster3DSuffix ".r3d" 4 #define DEBUG 0 9 5 10 6 // ======================================== Points on Boundary ================================= … … 568 564 } 569 565 ; 570 571 /** Creates the objects in a raster3d file (renderable with a header.r3d)572 * \param *out output stream for debugging573 * \param *tecplot output stream for tecplot data574 * \param *Tess Tesselation structure with constructed triangles575 * \param *mol molecule structure with atom positions576 */577 void write_raster3d_file(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, class molecule *mol)578 {579 atom *Walker = mol->start;580 bond *Binder = mol->first;581 int i;582 Vector *center = mol->DetermineCenterOfAll(out);583 if (rasterfile != NULL) {584 //cout << Verbose(1) << "Writing Raster3D file ... ";585 *rasterfile << "# Raster3D object description, created by MoleCuilder" << endl;586 *rasterfile << "@header.r3d" << endl;587 *rasterfile << "# All atoms as spheres" << endl;588 while (Walker->next != mol->end) {589 Walker = Walker->next;590 *rasterfile << "2" << endl << " "; // 2 is sphere type591 for (i=0;i<NDIM;i++)592 *rasterfile << Walker->x.x[i]+center->x[i] << " ";593 *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour594 }595 596 *rasterfile << "# All bonds as vertices" << endl;597 while (Binder->next != mol->last) {598 Binder = Binder->next;599 *rasterfile << "3" << endl << " "; // 2 is round-ended cylinder type600 for (i=0;i<NDIM;i++)601 *rasterfile << Binder->leftatom->x.x[i]+center->x[i] << " ";602 *rasterfile << "\t0.03\t";603 for (i=0;i<NDIM;i++)604 *rasterfile << Binder->rightatom->x.x[i]+center->x[i] << " ";605 *rasterfile << "\t0.03\t0. 0. 1." << endl; // radius 0.05 and blue as colour606 }607 608 *rasterfile << "# All tesselation triangles" << endl;609 for (TriangleMap::iterator TriangleRunner = Tess->TrianglesOnBoundary.begin(); TriangleRunner != Tess->TrianglesOnBoundary.end(); TriangleRunner++) {610 *rasterfile << "1" << endl << " "; // 1 is triangle type611 for (i=0;i<3;i++) { // print each node612 for (int j=0;j<NDIM;j++) // and for each node all NDIM coordinates613 *rasterfile << TriangleRunner->second->endpoints[i]->node->x.x[j]+center->x[j] << " ";614 *rasterfile << "\t";615 }616 *rasterfile << "1. 0. 0." << endl; // red as colour617 *rasterfile << "18" << endl << " 0.5 0.5 0.5" << endl; // 18 is transparency type for previous object618 }619 } else {620 cerr << "ERROR: Given rasterfile is " << rasterfile << "." << endl;621 }622 delete(center);623 };624 566 625 567 /* … … 1981 1923 /** This function finds a triangle to a line, adjacent to an existing one. 1982 1924 * @param out output stream for debugging 1925 * @param tecplot output stream for writing found triangles in TecPlot format 1983 1926 * @param mol molecule structure with all atoms and bonds 1984 1927 * @param Line current baseline to search from … … 1987 1930 * @param N number of found triangles 1988 1931 */ 1989 void Tesselation::Find_next_suitable_triangle(ofstream *out, 1932 void Tesselation::Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, 1990 1933 molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, 1991 const double& RADIUS, int N , const char *tempbasename)1934 const double& RADIUS, int N) 1992 1935 { 1993 1936 cout << Verbose(1) << "Looking for next suitable triangle \n"; … … 1996 1939 Vector Chord; 1997 1940 ofstream *tempstream = NULL; 1998 char NumberName[255]; 1999 double tmp; 2000 //atom* Walker; 1941 char filename[255]; 2001 1942 atom* OldThirdPoint; 2002 1943 … … 2067 2008 cout << "Letzter Winkel bei " << TrianglesOnBoundaryCount << " Winkel ist " << Storage[2] << endl; 2068 2009 2069 if ((TrianglesOnBoundaryCount % 10) == 0) { 2070 sprintf(NumberName, "-%d", TriangleFilesWritten); 2071 if (DoTecplotOutput) { 2072 string NameofTempFile(tempbasename); 2073 NameofTempFile.append(NumberName); 2074 NameofTempFile.append(TecplotSuffix); 2075 cout << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 2076 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 2077 write_tecplot_file(out, tempstream, this, mol, TriangleFilesWritten); 2078 tempstream->close(); 2079 tempstream->flush(); 2080 delete(tempstream); 2081 } 2082 if (DoRaster3DOutput) { 2083 string NameofTempFile(tempbasename); 2084 NameofTempFile.append(NumberName); 2085 NameofTempFile.append(Raster3DSuffix); 2086 cout << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 2087 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 2088 write_raster3d_file(out, tempstream, this, mol); 2089 tempstream->close(); 2090 tempstream->flush(); 2091 delete(tempstream); 2092 } 2093 if (DoTecplotOutput || DoRaster3DOutput) 2094 TriangleFilesWritten++; 2010 2011 if ((TrianglesOnBoundaryCount % 1) == 0) 2012 { 2013 sprintf(filename, "testEnvelope-%d.dat", TriangleFilesWritten); 2014 tempstream = new ofstream(filename, ios::trunc); 2015 write_tecplot_file(out, tempstream, this, mol, TriangleFilesWritten++); 2016 tempstream->close(); 2017 tempstream->flush(); 2018 delete(tempstream); 2095 2019 } 2096 2020 2097 // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke 2021 if (TrianglesOnBoundaryCount >189 and TrianglesOnBoundaryCount < 200 ) 2022 { 2023 cout << Verbose(1) 2024 << "No new Atom found, triangle construction will crash" << endl; 2025 write_tecplot_file(out, tecplot, this, mol, TriangleFilesWritten); 2026 cout << "This is currently added candidate" << Opt_Candidate << endl; 2027 } 2028 // Konstruiere nun neues Dreieck am Ende der Liste der Dreiecke 2098 2029 2099 2030 cout << " Optimal candidate is " << *Opt_Candidate << endl; … … 2298 2229 ; 2299 2230 2300 void Find_non_convex_border(ofstream *out, const char *filename, molecule* mol)2231 void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol) 2301 2232 { 2302 2233 int N = 0; … … 2306 2237 const double RADIUS = 6.; 2307 2238 LineMap::iterator baseline; 2308 cout << Verbose(0) << "Begin of Find_non_convex_border\n";2309 bool flag = false; // marks whether we went once through all baselines without finding any without two triangles2310 2239 Tess->Find_starting_triangle(mol, RADIUS); 2311 2240 … … 2316 2245 { 2317 2246 cout << Verbose(1) << "Begin of Tesselation ... " << endl; 2318 Tess->Find_next_suitable_triangle(out, mol,2247 Tess->Find_next_suitable_triangle(out, tecplot, mol, 2319 2248 *(baseline->second), 2320 *(((baseline->second->triangles.begin()))->second), RADIUS, N, filename); //the line is there, so there is a triangle, but only one. 2321 flag = true; 2249 *(((baseline->second->triangles.begin()))->second), RADIUS, N); //the line is there, so there is a triangle, but only one. 2322 2250 cout << Verbose(1) << "End of Tesselation ... " << endl; 2323 2251 } … … 2331 2259 baseline++; 2332 2260 } 2333 cout << Verbose(1) << "Writing final tecplot file\n"; 2334 if (DoTecplotOutput) { 2335 string Name(filename); 2336 Name.append(TecplotSuffix); 2337 ofstream tecplot(Name.c_str(), ios::trunc); 2338 write_tecplot_file(out, &tecplot, Tess, mol, -1); 2339 tecplot.close(); 2340 } 2341 if (DoRaster3DOutput) { 2342 string Name(filename); 2343 Name.append(Raster3DSuffix); 2344 ofstream raster(Name.c_str(), ios::trunc); 2345 write_raster3d_file(out, &raster, Tess, mol); 2346 raster.close(); 2347 } 2348 } 2349 ; 2261 write_tecplot_file(out, tecplot, Tess, mol, -1); 2262 2263 } 2264 ; -
src/boundary.hpp
r6d4a76 r23e09b 86 86 void AddTriangleToLines(); 87 87 void Find_starting_triangle(molecule* mol, const double RADIUS); 88 void Find_next_suitable_triangle(ofstream *out, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, const char *tempbasename);88 void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N); 89 89 90 90 PointMap PointsOnBoundary; … … 111 111 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity); 112 112 void Find_next_suitable_point(atom a, atom b, atom Candidate, int n, Vector *d1, Vector *d2, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule *mol, bool problem); 113 void Find_non_convex_border(ofstream *out, const char *filename, molecule* mol);113 void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol); 114 114 115 115 -
src/builder.cpp
r6d4a76 r23e09b 1025 1025 else { 1026 1026 cout << Verbose(0) << "Evaluating npn-convex envelope."; 1027 ofstream *output = new ofstream(argv[argptr], ios::trunc); 1027 1028 cout << Verbose(1) << "Storing tecplot data in " << argv[argptr] << "." << endl; 1028 Find_non_convex_border((ofstream *)&cout, argv[argptr], mol); 1029 Find_non_convex_border((ofstream *)&cout, output, mol); 1030 output->close(); 1031 delete(output); 1029 1032 argptr+=1; 1030 1033 } … … 1034 1037 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1035 1038 ExitFlag = 255; 1036 cerr << "Not enough or invalid arguments given for storing temp erature: -T <temperature file>" << endl;1039 cerr << "Not enough or invalid arguments given for storing tempature: -T <temperature file>" << endl; 1037 1040 } else { 1038 1041 cout << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.