Changeset 57066a for src/boundary.cpp
- Timestamp:
- Sep 28, 2009, 8:00:33 PM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- e4a379
- Parents:
- 91e7e4a
- git-author:
- Frederik Heber <heber@…> (09/28/09 18:47:54)
- git-committer:
- Frederik Heber <heber@…> (09/28/09 20:00:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r91e7e4a r57066a 112 112 ; 113 113 114 /** Creates the objects in a VRML file.115 * \param *out output stream for debugging116 * \param *vrmlfile output stream for tecplot data117 * \param *Tess Tesselation structure with constructed triangles118 * \param *mol molecule structure with atom positions119 */120 void WriteVrmlFile(ofstream *out, ofstream *vrmlfile, class Tesselation *Tess, class molecule *mol)121 {122 atom *Walker = mol->start;123 bond *Binder = mol->first;124 int i;125 Vector *center = mol->DetermineCenterOfAll(out);126 if (vrmlfile != NULL) {127 //cout << Verbose(1) << "Writing Raster3D file ... ";128 *vrmlfile << "#VRML V2.0 utf8" << endl;129 *vrmlfile << "#Created by molecuilder" << endl;130 *vrmlfile << "#All atoms as spheres" << endl;131 while (Walker->next != mol->end) {132 Walker = Walker->next;133 *vrmlfile << "Sphere {" << endl << " "; // 2 is sphere type134 for (i=0;i<NDIM;i++)135 *vrmlfile << Walker->x.x[i]-center->x[i] << " ";136 *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour137 }138 139 *vrmlfile << "# All bonds as vertices" << endl;140 while (Binder->next != mol->last) {141 Binder = Binder->next;142 *vrmlfile << "3" << endl << " "; // 2 is round-ended cylinder type143 for (i=0;i<NDIM;i++)144 *vrmlfile << Binder->leftatom->x.x[i]-center->x[i] << " ";145 *vrmlfile << "\t0.03\t";146 for (i=0;i<NDIM;i++)147 *vrmlfile << Binder->rightatom->x.x[i]-center->x[i] << " ";148 *vrmlfile << "\t0.03\t0. 0. 1." << endl; // radius 0.05 and blue as colour149 }150 151 *vrmlfile << "# All tesselation triangles" << endl;152 for (TriangleMap::iterator TriangleRunner = Tess->TrianglesOnBoundary.begin(); TriangleRunner != Tess->TrianglesOnBoundary.end(); TriangleRunner++) {153 *vrmlfile << "1" << endl << " "; // 1 is triangle type154 for (i=0;i<3;i++) { // print each node155 for (int j=0;j<NDIM;j++) // and for each node all NDIM coordinates156 *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->x[j]-center->x[j] << " ";157 *vrmlfile << "\t";158 }159 *vrmlfile << "1. 0. 0." << endl; // red as colour160 *vrmlfile << "18" << endl << " 0.5 0.5 0.5" << endl; // 18 is transparency type for previous object161 }162 } else {163 cerr << "ERROR: Given vrmlfile is " << vrmlfile << "." << endl;164 }165 delete(center);166 };167 168 /** Creates the objects in a raster3d file (renderable with a header.r3d).169 * \param *out output stream for debugging170 * \param *rasterfile output stream for tecplot data171 * \param *Tess Tesselation structure with constructed triangles172 * \param *mol molecule structure with atom positions173 */174 void WriteRaster3dFile(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, class molecule *mol)175 {176 atom *Walker = mol->start;177 bond *Binder = mol->first;178 int i;179 Vector *center = mol->DetermineCenterOfAll(out);180 if (rasterfile != NULL) {181 //cout << Verbose(1) << "Writing Raster3D file ... ";182 *rasterfile << "# Raster3D object description, created by MoleCuilder" << endl;183 *rasterfile << "@header.r3d" << endl;184 *rasterfile << "# All atoms as spheres" << endl;185 while (Walker->next != mol->end) {186 Walker = Walker->next;187 *rasterfile << "2" << endl << " "; // 2 is sphere type188 for (i=0;i<NDIM;i++)189 *rasterfile << Walker->x.x[i]-center->x[i] << " ";190 *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour191 }192 193 *rasterfile << "# All bonds as vertices" << endl;194 while (Binder->next != mol->last) {195 Binder = Binder->next;196 *rasterfile << "3" << endl << " "; // 2 is round-ended cylinder type197 for (i=0;i<NDIM;i++)198 *rasterfile << Binder->leftatom->x.x[i]-center->x[i] << " ";199 *rasterfile << "\t0.03\t";200 for (i=0;i<NDIM;i++)201 *rasterfile << Binder->rightatom->x.x[i]-center->x[i] << " ";202 *rasterfile << "\t0.03\t0. 0. 1." << endl; // radius 0.05 and blue as colour203 }204 205 *rasterfile << "# All tesselation triangles" << endl;206 *rasterfile << "8\n 25. -1. 1. 1. 1. 0.0 0 0 0 2\n SOLID 1.0 0.0 0.0\n BACKFACE 0.3 0.3 1.0 0 0\n";207 for (TriangleMap::iterator TriangleRunner = Tess->TrianglesOnBoundary.begin(); TriangleRunner != Tess->TrianglesOnBoundary.end(); TriangleRunner++) {208 *rasterfile << "1" << endl << " "; // 1 is triangle type209 for (i=0;i<3;i++) { // print each node210 for (int j=0;j<NDIM;j++) // and for each node all NDIM coordinates211 *rasterfile << TriangleRunner->second->endpoints[i]->node->node->x[j]-center->x[j] << " ";212 *rasterfile << "\t";213 }214 *rasterfile << "1. 0. 0." << endl; // red as colour215 //*rasterfile << "18" << endl << " 0.5 0.5 0.5" << endl; // 18 is transparency type for previous object216 }217 *rasterfile << "9\n# terminating special property\n";218 } else {219 cerr << "ERROR: Given rasterfile is " << rasterfile << "." << endl;220 }221 delete(center);222 };223 224 /** This function creates the tecplot file, displaying the tesselation of the hull.225 * \param *out output stream for debugging226 * \param *tecplot output stream for tecplot data227 * \param N arbitrary number to differentiate various zones in the tecplot format228 */229 void WriteTecplotFile(ofstream *out, ofstream *tecplot, class Tesselation *TesselStruct, class molecule *mol, int N)230 {231 if ((tecplot != NULL) && (TesselStruct != NULL)) {232 // write header233 *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl;234 *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\" \"U\"" << endl;235 *tecplot << "ZONE T=\"TRIANGLES" << N << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;236 int *LookupList = new int[mol->AtomCount];237 for (int i = 0; i < mol->AtomCount; i++)238 LookupList[i] = -1;239 240 // print atom coordinates241 *out << Verbose(2) << "The following triangles were created:";242 int Counter = 1;243 TesselPoint *Walker = NULL;244 for (PointMap::iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); target++) {245 Walker = target->second->node;246 LookupList[Walker->nr] = Counter++;247 *tecplot << Walker->node->x[0] << " " << Walker->node->x[1] << " " << Walker->node->x[2] << " " << target->second->value << endl;248 }249 *tecplot << endl;250 // print connectivity251 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {252 *out << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;253 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;254 }255 delete[] (LookupList);256 *out << endl;257 }258 }259 260 114 261 115 /** Determines the boundary points of a cluster. … … 536 390 537 391 // flip the line 538 if ( !mol->TesselStruct->PickFarthestofTwoBaselines(out, line))392 if (mol->TesselStruct->PickFarthestofTwoBaselines(out, line) == 0.) 539 393 *out << Verbose(1) << "ERROR: Correction of concave baselines failed!" << endl; 540 else 394 else { 395 mol->TesselStruct->FlipBaseline(out, line); 541 396 *out << Verbose(1) << "INFO: Correction of concave baselines worked." << endl; 397 } 542 398 } 543 399 } … … 644 500 class BoundaryLineSet *line = NULL; 645 501 bool Concavity; 502 char dummy[MAXSTRINGSIZE]; 646 503 PointMap::iterator PointRunner, PointAdvance; 647 504 LineMap::iterator LineRunner, LineAdvance; … … 656 513 } 657 514 658 //CalculateConcavityPerBoundaryPoint(out, TesselStruct);659 StoreTrianglesinFile(out, mol, filename, "-first");660 661 515 // First step: RemovePointFromTesselatedSurface 516 int run = 0; 517 double tmp; 662 518 do { 663 519 Concavity = false; 520 sprintf(dummy, "-first-%d", run); 521 //CalculateConcavityPerBoundaryPoint(out, TesselStruct); 522 StoreTrianglesinFile(out, mol, filename, dummy); 523 664 524 PointRunner = TesselStruct->PointsOnBoundary.begin(); 665 525 PointAdvance = PointRunner; // we need an advanced point, as the PointRunner might get removed … … 671 531 line = LineRunner->second; 672 532 *out << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 673 } 674 if (!line->CheckConvexityCriterion(out)) { 675 *out << Verbose(1) << "... point " << *point << " cannot be on convex envelope." << endl; 676 // remove the point 677 Concavity = true; 678 TesselStruct->RemovePointFromTesselatedSurface(out, point); 533 if (!line->CheckConvexityCriterion(out)) { 534 // remove the point if needed 535 *out << Verbose(1) << "... point " << *point << " cannot be on convex envelope." << endl; 536 volume += TesselStruct->RemovePointFromTesselatedSurface(out, point); 537 sprintf(dummy, "-first-%d", ++run); 538 StoreTrianglesinFile(out, mol, filename, dummy); 539 Concavity = true; 540 break; 541 } 679 542 } 680 543 PointRunner = PointAdvance; 681 544 } 682 545 546 sprintf(dummy, "-second-%d", run); 683 547 //CalculateConcavityPerBoundaryPoint(out, TesselStruct); 684 //StoreTrianglesinFile(out, mol, filename, "-second");548 StoreTrianglesinFile(out, mol, filename, dummy); 685 549 686 550 // second step: PickFarthestofTwoBaselines … … 693 557 // take highest of both lines 694 558 if (TesselStruct->IsConvexRectangle(out, line) == NULL) { 695 TesselStruct->PickFarthestofTwoBaselines(out, line); 696 Concavity = true; 559 tmp = TesselStruct->PickFarthestofTwoBaselines(out, line); 560 volume += tmp; 561 if (tmp != 0) { 562 mol->TesselStruct->FlipBaseline(out, line); 563 Concavity = true; 564 } 697 565 } 698 566 LineRunner = LineAdvance; 699 567 } 568 run++; 700 569 } while (Concavity); 701 CalculateConcavityPerBoundaryPoint(out, TesselStruct);702 StoreTrianglesinFile(out, mol, filename, "-third");570 //CalculateConcavityPerBoundaryPoint(out, TesselStruct); 571 //StoreTrianglesinFile(out, mol, filename, "-third"); 703 572 704 573 // third step: IsConvexRectangle … … 717 586 point = TesselStruct->IsConvexRectangle(out, line); 718 587 if (point != NULL) 719 TesselStruct->RemovePointFromTesselatedSurface(out, point);588 volume += TesselStruct->RemovePointFromTesselatedSurface(out, point); 720 589 } 721 590 LineRunner = LineAdvance; … … 723 592 724 593 CalculateConcavityPerBoundaryPoint(out, TesselStruct); 725 StoreTrianglesinFile(out, mol, filename, " -fourth");594 StoreTrianglesinFile(out, mol, filename, ""); 726 595 727 596 // end 597 *out << Verbose(1) << "Volume is " << volume << "." << endl; 728 598 *out << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl; 729 599 return volume; … … 993 863 if ((*ListRunner)->TesselStruct == NULL) { 994 864 *out << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl; 995 FindNonConvexBorder((ofstream *)&cout, (*ListRunner), LCList[i], NULL, 5.);865 FindNonConvexBorder((ofstream *)&cout, (*ListRunner), LCList[i], 5., NULL); 996 866 } 997 867 i++; … … 1115 985 * \param *Tess Tesselation filled with points, lines and triangles on boundary on return 1116 986 * \param *LCList atoms in LinkedCell list 987 * \param RADIUS radius of the virtual sphere 1117 988 * \param *filename filename prefix for output of vertex data 1118 * \para RADIUS radius of the virtual sphere 1119 */ 1120 void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename, const double RADIUS) 989 */ 990 void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL) 1121 991 { 1122 992 int N = 0; 1123 993 bool freeLC = false; 1124 ofstream *tempstream = NULL;1125 char NumberName[255];1126 int TriangleFilesWritten = 0;1127 994 1128 995 *out << Verbose(1) << "Entering search for non convex hull. " << endl; … … 1141 1008 bool failflag = false; 1142 1009 1010 // initialise Linked Cell 1143 1011 if (LCList == NULL) { 1144 1012 LCList = new LinkedCell(mol, 2.*RADIUS); … … 1146 1014 } 1147 1015 1016 // 1. get starting triangle 1148 1017 mol->TesselStruct->FindStartingTriangle(out, RADIUS, LCList); 1149 1018 1019 // 2. expand from there 1150 1020 baseline = mol->TesselStruct->LinesOnBoundary.begin(); 1151 // the outward most line is dangerous, as we may end up with wrapping up the starting triangle, hence 1152 // terminating the algorithm too early. 1153 if (baseline != mol->TesselStruct->LinesOnBoundary.end()) // skip first line as it its the outwardmost! 1154 baseline++; 1021 baseline++; // skip first line 1155 1022 while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (flag)) { 1156 1023 if (baseline->second->triangles.size() == 1) { 1157 failflag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, N, LCList); //the line is there, so there is a triangle, but only one. 1024 // 3. find next triangle 1025 failflag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1158 1026 flag = flag || failflag; 1159 1027 if (!failflag) 1160 1028 cerr << "WARNING: FindNextSuitableTriangle failed." << endl; 1029 1161 1030 // write temporary envelope 1162 if ((DoSingleStepOutput && (mol->TesselStruct->TrianglesOnBoundaryCount % SingleStepWidth == 0))) { // if we have a new triangle and want to output each new triangle configuration 1163 TriangleMap::iterator runner = mol->TesselStruct->TrianglesOnBoundary.end(); 1164 runner--; 1165 class BoundaryTriangleSet *triangle = runner->second; 1166 if (triangle != NULL) { 1167 sprintf(NumberName, "-%04d-%s_%s_%s", TriangleFilesWritten, triangle->endpoints[0]->node->Name, triangle->endpoints[1]->node->Name, triangle->endpoints[2]->node->Name); 1168 if (DoTecplotOutput) { 1169 string NameofTempFile(filename); 1170 NameofTempFile.append(NumberName); 1171 for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos)) 1172 NameofTempFile.erase(npos, 1); 1173 NameofTempFile.append(TecplotSuffix); 1174 *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 1175 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 1176 WriteTecplotFile(out, tempstream, mol->TesselStruct, mol, TriangleFilesWritten); 1177 tempstream->close(); 1178 tempstream->flush(); 1179 delete(tempstream); 1180 } 1181 1182 if (DoRaster3DOutput) { 1183 string NameofTempFile(filename); 1184 NameofTempFile.append(NumberName); 1185 for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos)) 1186 NameofTempFile.erase(npos, 1); 1187 NameofTempFile.append(Raster3DSuffix); 1188 *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 1189 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 1190 WriteRaster3dFile(out, tempstream, mol->TesselStruct, mol); 1191 // // include the current position of the virtual sphere in the temporary raster3d file 1192 // // make the circumsphere's center absolute again 1193 // helper.CopyVector(BaseRay->endpoints[0]->node->node); 1194 // helper.AddVector(BaseRay->endpoints[1]->node->node); 1195 // helper.Scale(0.5); 1196 // (*it)->OptCenter.AddVector(&helper); 1197 // Vector *center = mol->DetermineCenterOfAll(out); 1198 // (*it)->OptCenter.SubtractVector(center); 1199 // delete(center); 1200 // // and add to file plus translucency object 1201 // *tempstream << "# current virtual sphere\n"; 1202 // *tempstream << "8\n 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0\n"; 1203 // *tempstream << "2\n " << (*it)->OptCenter.x[0] << " " 1204 // << (*it)->OptCenter.x[1] << " " << (*it)->OptCenter.x[2] 1205 // << "\t" << RADIUS << "\t1 0 0\n"; 1206 // *tempstream << "9\n terminating special property\n"; 1207 tempstream->close(); 1208 tempstream->flush(); 1209 delete(tempstream); 1210 } 1211 } 1212 if (DoTecplotOutput || DoRaster3DOutput) 1213 TriangleFilesWritten++; 1031 if (filename != NULL) { 1032 if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0) || (mol->TesselStruct->TrianglesOnBoundary.size() > 8520 && mol->TesselStruct->TrianglesOnBoundary.size() <= 8530)))) { // if we have a new triangle and want to output each new triangle configuration 1033 mol->TesselStruct->Output(out, filename, mol); 1034 } 1214 1035 } 1036 baseline = mol->TesselStruct->LinesOnBoundary.end(); 1215 1037 } else { 1216 1038 //cout << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; … … 1220 1042 1221 1043 N++; 1222 baseline++;1223 1044 if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (flag)) { 1224 1045 baseline = mol->TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 1046 baseline++; 1225 1047 flag = false; 1226 1048 } 1227 1049 } 1050 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1051 mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList); 1052 // mol->GoToFirst(); 1053 // class TesselPoint *Runner = NULL; 1054 // while (!mol->IsEnd()) { 1055 // Runner = mol->GetPoint(); 1056 // *out << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl; 1057 // if (!mol->TesselStruct->IsInnerPoint(out, Runner, LCList)) { 1058 // *out << Verbose(2) << Runner->Name << " is outside of envelope, adding via degenerated triangles." << endl; 1059 // mol->TesselStruct->AddBoundaryPointByDegeneratedTriangle(out, Runner, LCList); 1060 // } else { 1061 // *out << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl; 1062 // } 1063 // mol->GoToNext(); 1064 // } 1228 1065 1229 1066 // Purges surplus triangles. 1230 1067 mol->TesselStruct->RemoveDegeneratedTriangles(); 1231 1232 // write final envelope1233 if (filename != 0) {1234 *out << Verbose(1) << "Writing final tecplot file\n";1235 if (DoTecplotOutput) {1236 string OutputName(filename);1237 OutputName.append(TecplotSuffix);1238 ofstream *tecplot = new ofstream(OutputName.c_str());1239 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, -1);1240 tecplot->close();1241 delete(tecplot);1242 }1243 if (DoRaster3DOutput) {1244 string OutputName(filename);1245 OutputName.append(Raster3DSuffix);1246 ofstream *raster = new ofstream(OutputName.c_str());1247 WriteRaster3dFile(out, raster, mol->TesselStruct, mol);1248 raster->close();1249 delete(raster);1250 }1251 } else {1252 cerr << "ERROR: Could definitively not find all necessary triangles!" << endl;1253 }1254 1068 1255 1069 cout << Verbose(2) << "Check: List of Baselines with not two connected triangles:" << endl; … … 1264 1078 *out << Verbose(2) << "None." << endl; 1265 1079 1266 // // Tests the IsInnerAtom() function. 1267 // Vector x (0, 0, 0); 1268 // *out << Verbose(0) << "Point to check: " << x << endl; 1269 // *out << Verbose(0) << "Check: IsInnerPoint() returns " << mol->TesselStruct->IsInnerPoint(out, x, LCList) 1270 // << "for vector " << x << "." << endl; 1271 // TesselPoint* a = mol->TesselStruct->PointsOnBoundary.begin()->second->node; 1272 // *out << Verbose(0) << "Point to check: " << *a << " (on boundary)." << endl; 1273 // *out << Verbose(0) << "Check: IsInnerAtom() returns " << mol->TesselStruct->IsInnerPoint(out, a, LCList) 1274 // << "for atom " << a << " (on boundary)." << endl; 1275 // LinkedNodes *List = NULL; 1276 // for (int i=0;i<NDIM;i++) { // each axis 1277 // LCList->n[i] = LCList->N[i]-1; // current axis is topmost cell 1278 // for (LCList->n[(i+1)%NDIM]=0;LCList->n[(i+1)%NDIM]<LCList->N[(i+1)%NDIM];LCList->n[(i+1)%NDIM]++) 1279 // for (LCList->n[(i+2)%NDIM]=0;LCList->n[(i+2)%NDIM]<LCList->N[(i+2)%NDIM];LCList->n[(i+2)%NDIM]++) { 1280 // List = LCList->GetCurrentCell(); 1281 // //cout << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1282 // if (List != NULL) { 1283 // for (LinkedNodes::iterator Runner = List->begin();Runner != List->end();Runner++) { 1284 // if (mol->TesselStruct->PointsOnBoundary.find((*Runner)->nr) == mol->TesselStruct->PointsOnBoundary.end()) { 1285 // a = *Runner; 1286 // i=3; 1287 // for (int j=0;j<NDIM;j++) 1288 // LCList->n[j] = LCList->N[j]; 1289 // break; 1290 // } 1291 // } 1292 // } 1293 // } 1294 // } 1295 // *out << Verbose(0) << "Check: IsInnerPoint() returns " << mol->TesselStruct->IsInnerPoint(out, a, LCList) 1296 // << "for atom " << a << " (inside)." << endl; 1080 // write final envelope 1081 CalculateConcavityPerBoundaryPoint(out, mol->TesselStruct); 1082 StoreTrianglesinFile(out, mol, filename, ""); 1297 1083 1298 1084 if (freeLC) … … 1300 1086 *out << Verbose(0) << "End of FindNonConvexBorder\n"; 1301 1087 }; 1088 1302 1089 1303 1090 /** Finds a hole of sufficient size in \a this molecule to embed \a *srcmol into it.
Note:
See TracChangeset
for help on using the changeset viewer.