Changes in / [6d4a76:23e09b]


Ignore:
Location:
src
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r6d4a76 r23e09b  
    22#include "boundary.hpp"
    33
    4 #define DEBUG 1
    5 #define DoTecplotOutput 0
    6 #define DoRaster3DOutput 1
    7 #define TecplotSuffix ".dat"
    8 #define Raster3DSuffix ".r3d"
     4#define DEBUG 0
    95
    106// ======================================== Points on Boundary =================================
     
    568564}
    569565;
    570 
    571 /** Creates the objects in a raster3d file (renderable with a header.r3d)
    572  * \param *out output stream for debugging
    573  * \param *tecplot output stream for tecplot data
    574  * \param *Tess Tesselation structure with constructed triangles
    575  * \param *mol molecule structure with atom positions
    576  */
    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 type
    591       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 colour
    594     }
    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 type
    600       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 colour
    606     }
    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 type
    611       for (i=0;i<3;i++) { // print each node
    612         for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
    613           *rasterfile << TriangleRunner->second->endpoints[i]->node->x.x[j]+center->x[j] << " ";
    614         *rasterfile << "\t";
    615       }
    616       *rasterfile << "1. 0. 0." << endl;  // red as colour
    617       *rasterfile << "18" << endl << "  0.5 0.5 0.5" << endl; // 18 is transparency type for previous object
    618     }
    619   } else {
    620     cerr << "ERROR: Given rasterfile is " << rasterfile << "." << endl;
    621   }
    622   delete(center);
    623 };
    624566
    625567/*
     
    19811923/** This function finds a triangle to a line, adjacent to an existing one.
    19821924 * @param out   output stream for debugging
     1925 * @param tecplot output stream for writing found triangles in TecPlot format
    19831926 * @param mol molecule structure with all atoms and bonds
    19841927 * @param Line current baseline to search from
     
    19871930 * @param N number of found triangles
    19881931 */
    1989 void Tesselation::Find_next_suitable_triangle(ofstream *out,
     1932void Tesselation::Find_next_suitable_triangle(ofstream *out, ofstream *tecplot,
    19901933    molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T,
    1991     const double& RADIUS, int N, const char *tempbasename)
     1934    const double& RADIUS, int N)
    19921935{
    19931936  cout << Verbose(1) << "Looking for next suitable triangle \n";
     
    19961939  Vector Chord;
    19971940  ofstream *tempstream = NULL;
    1998   char NumberName[255];
    1999   double tmp;
    2000   //atom* Walker;
     1941  char filename[255];
    20011942  atom* OldThirdPoint;
    20021943
     
    20672008      cout << "Letzter Winkel bei " << TrianglesOnBoundaryCount << " Winkel ist " << Storage[2] << endl;
    20682009
    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);
    20952019  }
    20962020
    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
    20982029
    20992030  cout << " Optimal candidate is " << *Opt_Candidate << endl;
     
    22982229;
    22992230
    2300 void Find_non_convex_border(ofstream *out, const char *filename, molecule* mol)
     2231void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol)
    23012232{
    23022233  int N = 0;
     
    23062237  const double RADIUS = 6.;
    23072238  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 triangles
    23102239  Tess->Find_starting_triangle(mol, RADIUS);
    23112240
     
    23162245        {
    23172246          cout << Verbose(1) << "Begin of Tesselation ... " << endl;
    2318           Tess->Find_next_suitable_triangle(out, mol,
     2247          Tess->Find_next_suitable_triangle(out, tecplot, mol,
    23192248              *(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.
    23222250          cout << Verbose(1) << "End of Tesselation ... " << endl;
    23232251        }
     
    23312259      baseline++;
    23322260    }
    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  
    8686    void AddTriangleToLines();
    8787    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);
    8989
    9090    PointMap PointsOnBoundary;
     
    111111void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity);
    112112void 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);
     113void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol);
    114114
    115115
  • src/builder.cpp

    r6d4a76 r23e09b  
    10251025                else {
    10261026                        cout << Verbose(0) << "Evaluating npn-convex envelope.";
     1027                        ofstream *output = new ofstream(argv[argptr], ios::trunc);
    10271028                        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);
    10291032                        argptr+=1;
    10301033                        }
     
    10341037              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    10351038                ExitFlag = 255;
    1036                 cerr << "Not enough or invalid arguments given for storing temperature: -T <temperature file>" << endl;
     1039                cerr << "Not enough or invalid arguments given for storing tempature: -T <temperature file>" << endl;
    10371040              } else {
    10381041                cout << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
Note: See TracChangeset for help on using the changeset viewer.