Changeset 34c43a
- Timestamp:
- Mar 1, 2011, 10:16:38 AM (14 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:
- caa06ef
- Parents:
- ba5215
- git-author:
- Frederik Heber <heber@…> (02/21/11 18:02:41)
- git-committer:
- Frederik Heber <heber@…> (03/01/11 10:16:38)
- Files:
-
- 2 added
- 2 deleted
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
rba5215 r34c43a 115 115 #AC_MSG_NOTICE(["GLU_CFLAGS: $GLU_CFLAGS, GLU_CXXFLAGS: $GLU_CXXFLAGS, GLU_LDFLAGS: $GLU_LDFLAGS, GLU_LIBS: $GLU_LIBS"]) 116 116 117 # CodePatterns library (needs bugfixed ObservedContainer)118 AM_PATH_CODEPATTERNS([1.0. 9], $have_debug,,[AC_MSG_ERROR([Missing CodePatterns library, please specify PKG_CONFIG_PATH or use --with-codepatterns...])])117 # CodePatterns library (needs ObservedIterator<> operator==,!= to be const) 118 AM_PATH_CODEPATTERNS([1.0.11], $have_debug,,[AC_MSG_ERROR([Missing CodePatterns library, please specify PKG_CONFIG_PATH or use --with-codepatterns...])]) 119 119 120 120 # Checks for header files. -
src/Actions/AnalysisAction/MolecularVolumeAction.cpp
rba5215 r34c43a 26 26 #include "CodePatterns/Log.hpp" 27 27 #include "CodePatterns/Verbose.hpp" 28 #include "PointCloudAdaptor.hpp" 28 29 #include "tesselation.hpp" 29 30 #include "World.hpp" … … 51 52 const LinkedCell *LCList = NULL; 52 53 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 53 LCList = new LinkedCell(*mol, 10.); 54 PointCloudAdaptor< molecule > cloud(mol); 55 LCList = new LinkedCell(cloud, 10.); 54 56 config * const configuration = World::getInstance().getConfig(); 55 57 //Boundaries *BoundaryPoints = NULL; -
src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
rba5215 r34c43a 25 25 #include "CodePatterns/Verbose.hpp" 26 26 #include "CodePatterns/Log.hpp" 27 #include "Descriptors/MoleculeIdDescriptor.hpp" 27 28 #include "element.hpp" 29 #include "LinearAlgebra/Vector.hpp" 28 30 #include "molecule.hpp" 29 31 #include "periodentafel.hpp" 32 #include "PointCloudAdaptor.hpp" 30 33 #include "tesselation.hpp" 31 #include "LinearAlgebra/Vector.hpp"32 34 #include "World.hpp" 33 35 … … 57 59 output.open(params.outputname.string().c_str()); 58 60 binoutput.open(params.binoutputname.string().c_str()); 59 ASSERT(params.Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 61 molecule *surfacemol = const_cast<molecule *>(params.Boundary); 62 ASSERT(surfacemol != NULL, "No molecule specified for SurfaceCorrelation."); 60 63 const double radius = 4.; 61 64 double LCWidth = 20.; … … 73 76 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); 74 77 std::cout << "There are " << molecules.size() << " selected molecules." << std::endl; 75 LCList = new LinkedCell(*params.Boundary, LCWidth); 76 FindNonConvexBorder(params.Boundary, TesselStruct, LCList, radius, NULL); 78 PointCloudAdaptor<molecule> cloud(surfacemol); 79 LCList = new LinkedCell(cloud, LCWidth); 80 FindNonConvexBorder(surfacemol, TesselStruct, LCList, radius, NULL); 77 81 CorrelationToSurfaceMap *surfacemap = NULL; 78 82 if (params.periodic) -
src/Actions/FragmentationAction/ConstructBondGraphAction.cpp
rba5215 r34c43a 26 26 #include "bond.hpp" 27 27 #include "bondgraph.hpp" 28 #include "CodePatterns/Log.hpp" 29 #include "CodePatterns/Verbose.hpp" 28 30 #include "config.hpp" 29 31 #include "linkedcell.hpp" 30 #include "CodePatterns/Log.hpp"31 #include "CodePatterns/Verbose.hpp"32 32 #include "molecule.hpp" 33 #include "PointCloudAdaptor.hpp" 33 34 #include "World.hpp" 34 35 #include "WorldTime.hpp" 35 36 36 37 #include <iostream> 38 #include <list> 37 39 #include <string> 38 40 … … 86 88 if ((AtomCount > 1) && (BondDistance > 1.)) { 87 89 DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl); 88 LinkedCell::LinkedNodeslist;90 TesselPointSTLList list; 89 91 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); 90 92 AtomRunner != World::getInstance().endAtomSelection(); … … 92 94 list.push_back(AtomRunner->second); 93 95 } 94 LC = new LinkedCell(list, BondDistance); 96 PointCloudAdaptor< TesselPointSTLList > cloud(&list); 97 LC = new LinkedCell(cloud, BondDistance); 95 98 96 99 // create a list to map Tesselpoint::nr to atom * … … 111 114 for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++) 112 115 for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) { 113 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();116 const TesselPointSTLList *List = LC->GetCurrentCell(); 114 117 // Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 115 118 if (List != NULL) { 116 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin();119 for (TesselPointSTLList::const_iterator Runner = List->begin(); 117 120 Runner != List->end(); 118 121 Runner++) { … … 124 127 for (n[1] = -1; n[1] <= 1; n[1]++) 125 128 for (n[2] = -1; n[2] <= 1; n[2]++) { 126 const LinkedCell::LinkedNodes*OtherList = LC->GetRelativeToCurrentCell(n);129 const TesselPointSTLList *OtherList = LC->GetRelativeToCurrentCell(n); 127 130 // Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 128 131 if (OtherList != NULL) { 129 for ( LinkedCell::LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {132 for (TesselPointSTLList::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) { 130 133 if (AtomIds.find(*OtherRunner)->second > AtomIds.find(Walker)->second) { 131 134 OtherWalker = dynamic_cast<atom*>(*OtherRunner); -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
rba5215 r34c43a 21 21 22 22 #include "boundary.hpp" 23 #include "CodePatterns/Log.hpp" 24 #include "CodePatterns/Verbose.hpp" 23 25 #include "config.hpp" 24 26 #include "linkedcell.hpp" 25 #include "CodePatterns/Log.hpp"26 27 #include "molecule.hpp" 28 #include "PointCloudAdaptor.hpp" 27 29 #include "tesselation.hpp" 28 #include "CodePatterns/Verbose.hpp"29 30 #include "World.hpp" 30 31 … … 55 56 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << params.filenameConvex << "." << endl); 56 57 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << params.filenameNonConvex << "." << endl); 57 LCList = new LinkedCell(*mol, 100.); 58 PointCloudAdaptor<molecule> cloud(mol); 59 LCList = new LinkedCell(cloud, 100.); 58 60 //Boundaries *BoundaryPoints = NULL; 59 61 //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]); -
src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
rba5215 r34c43a 21 21 22 22 #include "boundary.hpp" 23 #include "CodePatterns/Log.hpp" 24 #include "CodePatterns/Verbose.hpp" 23 25 #include "linkedcell.hpp" 24 #include "CodePatterns/Log.hpp"25 26 #include "molecule.hpp" 27 #include "PointCloudAdaptor.hpp" 26 28 #include "tesselation.hpp" 27 #include "CodePatterns/Verbose.hpp"28 29 #include "World.hpp" 29 30 … … 55 56 DoLog(1) && (Log() << Verbose(1) << "Specified molecule has " << Boundary->getAtomCount() << " atoms." << endl); 56 57 start = clock(); 57 LCList = new LinkedCell(*Boundary, params.SphereRadius*2.); 58 PointCloudAdaptor< molecule > cloud(Boundary); 59 LCList = new LinkedCell(cloud, params.SphereRadius*2.); 58 60 Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename.string().c_str()); 59 61 //FindDistributionOfEllipsoids(T, &LCList, N, number, params.filename.c_str()); -
src/Makefile.am
rba5215 r34c43a 143 143 BoundaryTriangleSet.cpp \ 144 144 CandidateForTesselation.cpp \ 145 PointCloud.cpp \146 145 tesselation.cpp \ 147 146 tesselationhelpers.cpp \ … … 154 153 BoundaryTriangleSet.hpp \ 155 154 CandidateForTesselation.hpp \ 156 PointCloud.hpp \ 155 IPointCloud.hpp \ 156 PointCloudAdaptor.hpp \ 157 157 tesselation.hpp \ 158 158 tesselationhelpers.hpp \ -
src/boundary.cpp
rba5215 r34c43a 18 18 #include "CodePatterns/MemDebug.hpp" 19 19 20 #include "BoundaryPointSet.hpp"21 #include "BoundaryLineSet.hpp"22 #include "BoundaryTriangleSet.hpp"23 #include "CandidateForTesselation.hpp"24 //#include "TesselPoint.hpp"25 #include "World.hpp"26 20 #include "atom.hpp" 27 21 #include "bond.hpp" 28 22 #include "boundary.hpp" 23 #include "BoundaryLineSet.hpp" 24 #include "BoundaryPointSet.hpp" 25 #include "BoundaryTriangleSet.hpp" 26 #include "Box.hpp" 27 #include "CandidateForTesselation.hpp" 28 #include "CodePatterns/Info.hpp" 29 #include "CodePatterns/Log.hpp" 30 #include "CodePatterns/Verbose.hpp" 29 31 #include "config.hpp" 30 32 #include "element.hpp" 31 33 #include "Helpers/helpers.hpp" 32 #include "CodePatterns/Info.hpp" 34 #include "LinearAlgebra/Plane.hpp" 35 #include "LinearAlgebra/RealSpaceMatrix.hpp" 33 36 #include "linkedcell.hpp" 34 #include "CodePatterns/Verbose.hpp"35 #include "CodePatterns/Log.hpp"36 37 #include "molecule.hpp" 38 #include "PointCloudAdaptor.hpp" 39 #include "RandomNumbers/RandomNumberGeneratorFactory.hpp" 40 #include "RandomNumbers/RandomNumberGenerator.hpp" 37 41 #include "tesselation.hpp" 38 42 #include "tesselationhelpers.hpp" 39 43 #include "World.hpp" 40 #include "LinearAlgebra/Plane.hpp"41 #include "LinearAlgebra/RealSpaceMatrix.hpp"42 #include "RandomNumbers/RandomNumberGeneratorFactory.hpp"43 #include "RandomNumbers/RandomNumberGenerator.hpp"44 #include "Box.hpp"45 44 46 45 #include <iostream> … … 378 377 379 378 // 3b. go through all lines, that are not yet part of two triangles (only of one so far) 380 TesselStruct->TesselateOnBoundary(mol); 379 PointCloudAdaptor< molecule > cloud(const_cast<molecule *>(mol)); 380 TesselStruct->TesselateOnBoundary(cloud); 381 381 382 382 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 383 if (!TesselStruct->InsertStraddlingPoints( mol, LCList))383 if (!TesselStruct->InsertStraddlingPoints(cloud, LCList)) 384 384 DoeLog(1) && (eLog()<< Verbose(1) << "Insertion of straddling points failed!" << endl); 385 385 … … 645 645 { 646 646 Info FunctionInfo(__func__); 647 PointCloudAdaptor< molecule > cloud(const_cast<molecule *>(mol)); 647 648 // 4. Store triangles in tecplot file 648 649 if (filename != NULL) { … … 652 653 OutputName.append(TecplotSuffix); 653 654 ofstream *tecplot = new ofstream(OutputName.c_str()); 654 WriteTecplotFile(tecplot, TesselStruct, mol, -1);655 WriteTecplotFile(tecplot, TesselStruct, cloud, -1); 655 656 tecplot->close(); 656 657 delete(tecplot); … … 661 662 OutputName.append(Raster3DSuffix); 662 663 ofstream *rasterplot = new ofstream(OutputName.c_str()); 663 WriteRaster3dFile(rasterplot, TesselStruct, mol);664 WriteRaster3dFile(rasterplot, TesselStruct, cloud); 664 665 rasterplot->close(); 665 666 delete(rasterplot); … … 699 700 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 700 701 GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem); 701 LinkedCell *LCList = new LinkedCell(*mol, 10.); 702 PointCloudAdaptor< molecule > cloud(mol); 703 LinkedCell *LCList = new LinkedCell(cloud, 10.); 702 704 FindConvexBorder(mol, BoundaryPoints, TesselStruct, (const LinkedCell *&)LCList, NULL); 703 705 delete (LCList); … … 808 810 if ((*ListRunner)->getAtomCount() > 0) { 809 811 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl); 810 LCList[(*ListRunner)] = new LinkedCell(*(*ListRunner), 10.); // get linked cell list 812 PointCloudAdaptor< molecule > cloud(*ListRunner); 813 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list 811 814 DoLog(1) && (Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl); 812 815 TesselStruct[(*ListRunner)] = NULL; … … 1015 1018 { 1016 1019 size_t compareTo = 0; 1017 LinkedCell::LinkedNodes* liste = LC->GetPointsInsideSphere(boundary == 0. ? MYEPSILON : boundary, &CurrentPosition);1020 TesselPointSTLList* liste = LC->GetPointsInsideSphere(boundary == 0. ? MYEPSILON : boundary, &CurrentPosition); 1018 1021 if (filler != NULL) { 1019 for ( LinkedCell::LinkedNodes::const_iterator iter = liste->begin();1022 for (TesselPointSTLList::const_iterator iter = liste->begin(); 1020 1023 iter != liste->end(); 1021 1024 ++iter) { … … 1031 1034 if (!result) { 1032 1035 DoLog(0) && (Log() << Verbose(0) << "Skipping because of the following atoms:" << std::endl); 1033 for ( LinkedCell::LinkedNodes::const_iterator iter = liste->begin();1036 for (TesselPointSTLList::const_iterator iter = liste->begin(); 1034 1037 iter != liste->end(); 1035 1038 ++iter) { … … 1084 1087 if ((*ListRunner)->getAtomCount() > 0) { 1085 1088 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl); 1086 LCList[(*ListRunner)] = new LinkedCell(*(*ListRunner), 10.); // get linked cell list 1089 PointCloudAdaptor< molecule > cloud(*ListRunner); 1090 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list 1087 1091 } 1088 1092 … … 1215 1219 * \return true - tesselation successful, false - tesselation failed 1216 1220 */ 1217 bool FindNonConvexBorder( constmolecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)1221 bool FindNonConvexBorder(molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 1218 1222 { 1219 1223 Info FunctionInfo(__func__); … … 1236 1240 1237 1241 // initialise Linked Cell 1242 PointCloudAdaptor< molecule > cloud(mol); 1238 1243 if (LCList == NULL) { 1239 LCList = new LinkedCell( *mol, 2.*RADIUS);1244 LCList = new LinkedCell(cloud, 2.*RADIUS); 1240 1245 freeLC = true; 1241 1246 } … … 1248 1253 if (filename != NULL) { 1249 1254 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1250 TesselStruct->Output(filename, mol);1255 TesselStruct->Output(filename, cloud); 1251 1256 } 1252 1257 } … … 1288 1293 if (filename != NULL) { 1289 1294 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1290 TesselStruct->Output(filename, mol);1295 TesselStruct->Output(filename, cloud); 1291 1296 } 1292 1297 } -
src/boundary.hpp
rba5215 r34c43a 42 42 void FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double MaxDistance, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation); 43 43 void FillVoidWithMolecule(molecule *&filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const double MinDistance, const bool DoRandomRotation); 44 44 void FindConvexBorder(const molecule* const mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename); 45 45 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol); 46 bool FindNonConvexBorder( constmolecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);46 bool FindNonConvexBorder(molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename); 47 47 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct); 48 48 double * GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem); -
src/ellipsoid.cpp
rba5215 r34c43a 284 284 DoLog(2) && (Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ... "); 285 285 // get random cell 286 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();286 const TesselPointSTLList *List = LC->GetCurrentCell(); 287 287 if (List == NULL) { // set index to it 288 288 continue; … … 303 303 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 304 304 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 305 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();305 const TesselPointSTLList *List = LC->GetCurrentCell(); 306 306 PointsLeft += List->size(); 307 307 } … … 328 328 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 329 329 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 330 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();330 const TesselPointSTLList *List = LC->GetCurrentCell(); 331 331 // Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 332 332 if (List != NULL) { … … 335 335 // else 336 336 // Log() << Verbose(2) << "Cell is empty ... " << endl; 337 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {337 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 338 338 if ((current != PickedAtomNrs.end()) && (*current == index)) { 339 339 Candidate = (*Runner); -
src/linkedcell.cpp
rba5215 r34c43a 25 25 #include "CodePatterns/Log.hpp" 26 26 #include "molecule.hpp" 27 #include " PointCloud.hpp"27 #include "IPointCloud.hpp" 28 28 #include "tesselation.hpp" 29 29 #include "LinearAlgebra/Vector.hpp" 30 30 31 31 // ========================================================= class LinkedCell =========================================== 32 33 /** Constructor for class LinkedCell::LinkedNodes.34 */35 LinkedCell::LinkedNodes::LinkedNodes()36 {}37 38 /** Destructor for class LinkedCell::LinkedNodes.39 */40 LinkedCell::LinkedNodes::~LinkedNodes()41 {}42 43 TesselPoint * LinkedCell::LinkedNodes::getValue (const_iterator &rhs) const44 {45 return *rhs;46 }47 48 TesselPoint * LinkedCell::LinkedNodes::getValue (iterator &rhs) const49 {50 return *rhs;51 }52 32 53 33 /** Constructor for class LinkedCell. … … 68 48 * \param RADIUS edge length of cells 69 49 */ 70 LinkedCell::LinkedCell( constPointCloud & set, const double radius) :50 LinkedCell::LinkedCell(IPointCloud & set, const double radius) : 71 51 LC(NULL), 72 52 RADIUS(radius), … … 117 97 } 118 98 ASSERT(N[0]*N[1]*N[2] < MAX_LINKEDCELLNODES, "Number linked of linked cell nodes exceded hard-coded limit, use greater edge length!"); 119 LC = new LinkedNodes[N[0]*N[1]*N[2]];99 LC = new TesselPointSTLList[N[0]*N[1]*N[2]]; 120 100 for (index=0;index<N[0]*N[1]*N[2];index++) { 121 101 LC [index].clear(); … … 184 164 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[] are out of bounds. 185 165 */ 186 const LinkedCell::LinkedNodes* LinkedCell::GetCurrentCell() const166 const TesselPointSTLList* LinkedCell::GetCurrentCell() const 187 167 { 188 168 if (CheckBounds()) { … … 198 178 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[]+relative[] are out of bounds. 199 179 */ 200 const LinkedCell::LinkedNodes* LinkedCell::GetRelativeToCurrentCell(const int relative[NDIM]) const180 const TesselPointSTLList* LinkedCell::GetRelativeToCurrentCell(const int relative[NDIM]) const 201 181 { 202 182 if (CheckBounds(relative)) { … … 232 212 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 233 213 if (CheckBounds()) { 234 for ( LinkedNodes::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++)214 for (TesselPointSTLList::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++) 235 215 status = status || ((*Runner) == Walker); 236 216 return status; … … 267 247 * \return list of tesselpoints 268 248 */ 269 LinkedCell::LinkedNodes* LinkedCell::GetallNeighbours(const double distance) const249 TesselPointSTLList* LinkedCell::GetallNeighbours(const double distance) const 270 250 { 271 251 int Nlower[NDIM], Nupper[NDIM]; 272 252 TesselPoint *Walker = NULL; 273 LinkedNodes *TesselList = new LinkedNodes;253 TesselPointSTLList *TesselList = new TesselPointSTLList; 274 254 275 255 // then go through the current and all neighbouring cells and check the contained points for possible candidates … … 281 261 for (n[1] = Nlower[1]; n[1] <= Nupper[1]; n[1]++) 282 262 for (n[2] = Nlower[2]; n[2] <= Nupper[2]; n[2]++) { 283 const LinkedNodes*List = GetCurrentCell();263 const TesselPointSTLList *List = GetCurrentCell(); 284 264 //Log() << Verbose(1) << "Current cell is " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl; 285 265 if (List != NULL) { 286 for ( LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {266 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 287 267 Walker = *Runner; 288 268 TesselList->push_back(Walker); … … 346 326 * \return list of all points inside sphere 347 327 */ 348 LinkedCell::LinkedNodes* LinkedCell::GetPointsInsideSphere(const double radius, const Vector * const center) const328 TesselPointSTLList* LinkedCell::GetPointsInsideSphere(const double radius, const Vector * const center) const 349 329 { 350 330 const double radiusSquared = radius*radius; 351 331 TesselPoint *Walker = NULL; 352 LinkedNodes *TesselList = new LinkedNodes;353 LinkedNodes*NeighbourList = NULL;332 TesselPointSTLList *TesselList = new TesselPointSTLList; 333 TesselPointSTLList *NeighbourList = NULL; 354 334 355 335 // set index of LC to center of sphere … … 365 345 //Log() << Verbose(1) << "I found " << NeighbourList->size() << " neighbours to check." << endl; 366 346 if (NeighbourList != NULL) { 367 for ( LinkedNodes::const_iterator Runner = NeighbourList->begin(); Runner != NeighbourList->end(); Runner++) {347 for (TesselPointSTLList::const_iterator Runner = NeighbourList->begin(); Runner != NeighbourList->end(); Runner++) { 368 348 Walker = *Runner; 369 349 //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl; -
src/linkedcell.hpp
rba5215 r34c43a 29 29 #include "CodePatterns/Verbose.hpp" 30 30 #include "Helpers/defs.hpp" 31 #include "LinearAlgebra/Vector.hpp" 31 32 #include "World.hpp" 32 #include "LinearAlgebra/Vector.hpp"33 33 34 34 /****************************************** forward declarations *****************************/ 35 35 36 class PointCloud;36 class IPointCloud; 37 37 class TesselPoint; 38 38 … … 44 44 /********************************************** declarations *******************************/ 45 45 46 typedef std::list<TesselPoint *> TesselPointSTLList; 47 46 48 /** Linked Cell class for containing Vectors in real space efficiently. 47 49 */ … … 50 52 51 53 public: 52 class LinkedNodes : public std::list<TesselPoint *> {53 public:54 LinkedNodes();55 ~LinkedNodes();56 57 TesselPoint * getValue (const_iterator &rhs) const;58 TesselPoint * getValue (iterator &rhs) const;59 };60 //typedef list<TesselPoint *> LinkedNodes;61 62 63 54 Vector max; // upper boundary 64 55 Vector min; // lower boundary 65 LinkedNodes*LC; // linked cell list56 TesselPointSTLList *LC; // linked cell list 66 57 double RADIUS; // cell edge length 67 58 int N[NDIM]; // number of cells per axis … … 70 61 71 62 LinkedCell(); 72 LinkedCell(const PointCloud &set, const double radius); 73 template <class T> LinkedCell(const T &set, const double radius) : 74 LC(NULL), 75 RADIUS(radius), 76 index(-1) 77 { 78 class TesselPoint *Walker = NULL; 79 for(int i=0;i<NDIM;i++) 80 N[i] = 0; 81 max.Zero(); 82 min.Zero(); 83 DoLog(1) && (Log() << Verbose(1) << "Begin of LinkedCell" << endl); 84 if (set.begin() == set.end()) { 85 DoeLog(1) && (eLog()<< Verbose(1) << "set contains no linked cell nodes!" << endl); 86 return; 87 } 88 // 1. find max and min per axis of atoms 89 typename T::const_iterator Runner = set.begin(); 90 for (int i=0;i<NDIM;i++) { 91 max[i] = set.getValue(Runner)->at(i); 92 min[i] = set.getValue(Runner)->at(i); 93 } 94 for (typename T::const_iterator Runner = set.begin(); Runner != set.end(); Runner++) { 95 Walker = set.getValue(Runner); 96 for (int i=0;i<NDIM;i++) { 97 if (max[i] < Walker->at(i)) 98 max[i] = Walker->at(i); 99 if (min[i] > Walker->at(i)) 100 min[i] = Walker->at(i); 101 } 102 } 103 DoLog(2) && (Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl); 104 105 // 2. find then number of cells per axis 106 for (int i=0;i<NDIM;i++) { 107 N[i] = static_cast<int>(floor((max[i] - min[i])/RADIUS)+1); 108 } 109 DoLog(2) && (Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl); 110 111 // 3. allocate the lists 112 DoLog(2) && (Log() << Verbose(2) << "Allocating cells ... "); 113 if (LC != NULL) { 114 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl); 115 return; 116 } 117 ASSERT(N[0]*N[1]*N[2] < MAX_LINKEDCELLNODES, "Number linked of linked cell nodes exceded hard-coded limit, use greater edge length!"); 118 LC = new LinkedNodes[N[0]*N[1]*N[2]]; 119 for (index=0;index<N[0]*N[1]*N[2];index++) { 120 LC [index].clear(); 121 } 122 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 123 124 // 4. put each atom into its respective cell 125 DoLog(2) && (Log() << Verbose(2) << "Filling cells ... "); 126 for (typename T::const_iterator Runner = set.begin(); Runner != set.end(); Runner++) { 127 Walker = set.getValue(Runner); 128 for (int i=0;i<NDIM;i++) { 129 n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS)); 130 } 131 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 132 LC[index].push_back(Walker); 133 //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl; 134 } 135 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 136 DoLog(1) && (Log() << Verbose(1) << "End of LinkedCell" << endl); 137 }; 138 139 63 LinkedCell(IPointCloud &set, const double radius); 140 64 ~LinkedCell(); 141 const LinkedCell::LinkedNodes* GetCurrentCell()const ;142 const LinkedCell::LinkedNodes* GetRelativeToCurrentCell(const int relative[NDIM])const ;65 const TesselPointSTLList* GetCurrentCell()const ; 66 const TesselPointSTLList* GetRelativeToCurrentCell(const int relative[NDIM])const ; 143 67 bool SetIndexToNode(const TesselPoint * const Walker)const ; 144 68 bool SetIndexToVector(const Vector &x)const ; … … 148 72 void GetNeighbourBounds(int lower[NDIM], int upper[NDIM], int step = 1)const ; 149 73 150 LinkedCell::LinkedNodes* GetallNeighbours(const double distance = 0) const;151 LinkedCell::LinkedNodes* GetPointsInsideSphere(const double radius, const Vector * const center) const;74 TesselPointSTLList* GetallNeighbours(const double distance = 0) const; 75 TesselPointSTLList* GetPointsInsideSphere(const double radius, const Vector * const center) const; 152 76 // not implemented yet 153 77 bool AddNode(Vector *Walker); -
src/molecule.cpp
rba5215 r34c43a 57 57 elemente(teil), MDSteps(0), BondCount(0), NoNonHydrogen(0), NoNonBonds(0), 58 58 NoCyclicBonds(0), BondDistance(0.), ActiveFlag(false), IndexNr(-1), 59 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0) , InternalPointer(atoms.begin())59 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0) 60 60 { 61 61 -
src/molecule.hpp
rba5215 r34c43a 25 25 #include "types.hpp" 26 26 #include "graph.hpp" 27 #include "PointCloud.hpp"28 27 #include "CodePatterns/Observer.hpp" 29 28 #include "CodePatterns/ObservedIterator.hpp" … … 81 80 * Class incorporates number of types 82 81 */ 83 class molecule : public PointCloud, publicObservable82 class molecule : public Observable 84 83 { 85 84 friend molecule *NewMolecule(); … … 156 155 pair<iterator, bool> insert(atom * const key); 157 156 bool containsAtom(atom* key); 158 159 // re-definition of virtual functions from PointCloud160 const char * const GetName() const;161 Vector *GetCenter() const;162 TesselPoint *GetPoint() const;163 int GetMaxId() const;164 void GoToNext() const;165 void GoToFirst() const;166 bool IsEmpty() const;167 bool IsEnd() const;168 157 169 158 /// remove atoms from molecule. … … 283 272 void init_DFS(struct DFSAccounting&) const; 284 273 int last_atom; //!< number given to last atom 285 mutable internal_iterator InternalPointer; //!< internal pointer for PointCloud286 274 }; 287 275 -
src/molecule_graph.cpp
rba5215 r34c43a 25 25 #include "bond.hpp" 26 26 #include "bondgraph.hpp" 27 #include "Box.hpp" 28 #include "CodePatterns/Assert.hpp" 29 #include "CodePatterns/Info.hpp" 30 #include "CodePatterns/Log.hpp" 31 #include "CodePatterns/Verbose.hpp" 27 32 #include "config.hpp" 28 33 #include "element.hpp" … … 33 38 #include "linkedcell.hpp" 34 39 #include "molecule.hpp" 40 #include "PointCloudAdaptor.hpp" 35 41 #include "World.hpp" 36 42 #include "WorldTime.hpp" 37 #include "Box.hpp"38 39 #include "CodePatterns/Assert.hpp"40 #include "CodePatterns/Info.hpp"41 #include "CodePatterns/Log.hpp"42 #include "CodePatterns/Verbose.hpp"43 43 44 44 #define MAXBONDS 8 … … 162 162 if ((getAtomCount() > 1) && (bonddistance > 0.1)) { 163 163 DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl); 164 LC = new LinkedCell(*this, bonddistance); 164 PointCloudAdaptor<molecule> cloud(this); 165 LC = new LinkedCell(cloud, bonddistance); 165 166 166 167 // create a list to map Tesselpoint::nr to atom * … … 178 179 for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++) 179 180 for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) { 180 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();181 const TesselPointSTLList *List = LC->GetCurrentCell(); 181 182 Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 182 183 if (List != NULL) { 183 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {184 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 184 185 Walker = dynamic_cast<atom*>(*Runner); 185 186 ASSERT(Walker,"Tesselpoint that was not an atom retrieved from LinkedNode"); … … 189 190 for (n[1] = -1; n[1] <= 1; n[1]++) 190 191 for (n[2] = -1; n[2] <= 1; n[2]++) { 191 const LinkedCell::LinkedNodes*OtherList = LC->GetRelativeToCurrentCell(n);192 const TesselPointSTLList *OtherList = LC->GetRelativeToCurrentCell(n); 192 193 if (OtherList != NULL) { 193 194 Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 194 for ( LinkedCell::LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {195 for (TesselPointSTLList::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) { 195 196 if ((*OtherRunner)->nr > Walker->nr) { 196 197 OtherWalker = dynamic_cast<atom*>(*OtherRunner); -
src/molecule_pointcloud.cpp
rba5215 r34c43a 37 37 } 38 38 39 /** Returns a name for this point cloud, here the molecule's name.40 * \return name of point cloud41 */42 const char * const molecule::GetName() const43 {44 return name;45 };46 47 /** Determine center of all atoms.48 * \param *out output stream for debugging49 * \return pointer to allocated with central coordinates50 */51 Vector *molecule::GetCenter() const52 {53 Vector *center = DetermineCenterOfAll();54 return center;55 };56 57 58 /** PointCloud implementation of GoPoint59 * Uses atoms and STL stuff.60 */61 TesselPoint* molecule::GetPoint() const62 {63 return (*InternalPointer);64 };65 66 /** PointCloud implementation of GoToNext.67 * Uses atoms and STL stuff.68 */69 void molecule::GoToNext() const70 {71 if (InternalPointer != atoms.end())72 InternalPointer++;73 };74 75 /** PointCloud implementation of GoToFirst.76 * Uses atoms and STL stuff.77 */78 void molecule::GoToFirst() const79 {80 // evil hack necessary because81 // -# although InternalPointer is mutable82 // -# only const_iterator begin() is called due to const in the function declaration above83 // -# and there is no cast from const_iterator to const iterator84 atomSet::const_iterator test = begin();85 InternalPointer = *(reinterpret_cast<atomSet::iterator *>(&test));86 };87 88 /** PointCloud implementation of IsEmpty.89 * Uses atoms and STL stuff.90 */91 bool molecule::IsEmpty() const92 {93 return (empty());94 };95 96 /** PointCloud implementation of IsLast.97 * Uses atoms and STL stuff.98 */99 bool molecule::IsEnd() const100 {101 return (InternalPointer == atoms.end());102 };103 104 int molecule::GetMaxId() const {105 return getAtomCount();106 } -
src/tesselation.cpp
rba5215 r34c43a 23 23 #include <iomanip> 24 24 25 #include "Helpers/helpers.hpp"26 #include "CodePatterns/Info.hpp"27 25 #include "BoundaryPointSet.hpp" 28 26 #include "BoundaryLineSet.hpp" 29 27 #include "BoundaryTriangleSet.hpp" 30 28 #include "BoundaryPolygonSet.hpp" 31 #include "TesselPoint.hpp"32 29 #include "CandidateForTesselation.hpp" 33 #include "PointCloud.hpp" 34 #include "linkedcell.hpp" 30 #include "CodePatterns/Assert.hpp" 31 #include "CodePatterns/Info.hpp" 32 #include "CodePatterns/IteratorAdaptors.hpp" 35 33 #include "CodePatterns/Log.hpp" 36 #include "tesselation.hpp" 37 #include "tesselationhelpers.hpp" 38 #include "triangleintersectionlist.hpp" 34 #include "CodePatterns/Verbose.hpp" 35 #include "Exceptions/LinearDependenceException.hpp" 36 #include "Helpers/fast_functions.hpp" 37 #include "Helpers/helpers.hpp" 38 #include "IPointCloud.hpp" 39 39 #include "LinearAlgebra/Vector.hpp" 40 40 #include "LinearAlgebra/Line.hpp" 41 41 #include "LinearAlgebra/vector_ops.hpp" 42 #include "CodePatterns/Verbose.hpp"43 42 #include "LinearAlgebra/Plane.hpp" 44 #include "Exceptions/LinearDependenceException.hpp" 45 #include "CodePatterns/Assert.hpp" 46 47 #include "Helpers/fast_functions.hpp" 43 #include "linkedcell.hpp" 44 #include "PointCloudAdaptor.hpp" 45 #include "tesselation.hpp" 46 #include "tesselationhelpers.hpp" 47 #include "TesselPoint.hpp" 48 #include "triangleintersectionlist.hpp" 48 49 49 50 class molecule; … … 86 87 DoLog(0) && (Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl); 87 88 } 88 ;89 90 TesselPoint * Tesselation::getValue(const_iterator &rhs) const91 {92 return (*rhs).second->node;93 }94 95 TesselPoint * Tesselation::getValue(iterator &rhs) const96 {97 return (*rhs).second->node;98 }99 100 const char * const Tesselation::GetName() const101 {102 return "unknown";103 }104 105 /** PointCloud implementation of GetCenter106 * Uses PointsOnBoundary and STL stuff.107 */108 Vector * Tesselation::GetCenter() const109 {110 Info FunctionInfo(__func__);111 Vector *Center = new Vector(0., 0., 0.);112 int num = 0;113 for (GoToFirst(); (!IsEnd()); GoToNext()) {114 (*Center) += (GetPoint()->getPosition());115 num++;116 }117 Center->Scale(1. / num);118 return Center;119 }120 ;121 122 /** PointCloud implementation of GoPoint123 * Uses PointsOnBoundary and STL stuff.124 */125 TesselPoint * Tesselation::GetPoint() const126 {127 Info FunctionInfo(__func__);128 return (InternalPointer->second->node);129 }130 ;131 132 int Tesselation::GetMaxId() const133 {134 int max_id = 0;135 for (PointMap::const_iterator iter = PointsOnBoundary.begin();136 iter != PointsOnBoundary.end();137 ++iter) {138 if ((iter->second)->node->nr > max_id)139 (iter->second)->node->nr = max_id;140 }141 return max_id;142 }143 144 /** PointCloud implementation of GoToNext.145 * Uses PointsOnBoundary and STL stuff.146 */147 void Tesselation::GoToNext() const148 {149 Info FunctionInfo(__func__);150 if (InternalPointer != PointsOnBoundary.end())151 InternalPointer++;152 }153 ;154 155 /** PointCloud implementation of GoToFirst.156 * Uses PointsOnBoundary and STL stuff.157 */158 void Tesselation::GoToFirst() const159 {160 Info FunctionInfo(__func__);161 InternalPointer = PointsOnBoundary.begin();162 }163 ;164 165 /** PointCloud implementation of IsEmpty.166 * Uses PointsOnBoundary and STL stuff.167 */168 bool Tesselation::IsEmpty() const169 {170 Info FunctionInfo(__func__);171 return (PointsOnBoundary.empty());172 }173 ;174 175 /** PointCloud implementation of IsLast.176 * Uses PointsOnBoundary and STL stuff.177 */178 bool Tesselation::IsEnd() const179 {180 Info FunctionInfo(__func__);181 return (InternalPointer == PointsOnBoundary.end());182 }183 ;184 89 185 90 /** Gueses first starting triangle of the convex envelope. … … 318 223 * \param *cloud cluster of points 319 224 */ 320 void Tesselation::TesselateOnBoundary( const PointCloud * constcloud)225 void Tesselation::TesselateOnBoundary(IPointCloud & cloud) 321 226 { 322 227 Info FunctionInfo(__func__); … … 328 233 LineMap::iterator LineChecker[2]; 329 234 330 Center = cloud ->GetCenter();235 Center = cloud.GetCenter(); 331 236 // create a first tesselation with the given BoundaryPoints 332 237 do { … … 509 414 * \return true - all straddling points insert, false - something went wrong 510 415 */ 511 bool Tesselation::InsertStraddlingPoints( const PointCloud *cloud, const LinkedCell *LC)416 bool Tesselation::InsertStraddlingPoints(IPointCloud & cloud, const LinkedCell *LC) 512 417 { 513 418 Info FunctionInfo(__func__); 514 419 Vector Intersection, Normal; 515 420 TesselPoint *Walker = NULL; 516 Vector *Center = cloud ->GetCenter();421 Vector *Center = cloud.GetCenter(); 517 422 TriangleList *triangles = NULL; 518 423 bool AddFlag = false; … … 520 425 bool SuccessFlag = true; 521 426 522 cloud->GoToFirst(); 523 BoundaryPoints = new LinkedCell(*this, 5.); 524 while (!cloud->IsEnd()) { // we only have to go once through all points, as boundary can become only bigger 427 cloud.GoToFirst(); 428 PointCloudAdaptor< Tesselation, MapValueIterator<Tesselation::iterator> > newcloud(this); 429 BoundaryPoints = new LinkedCell(newcloud, 5.); 430 while (!cloud.IsEnd()) { // we only have to go once through all points, as boundary can become only bigger 525 431 if (AddFlag) { 526 432 delete (BoundaryPoints); 527 BoundaryPoints = new LinkedCell( *this, 5.);433 BoundaryPoints = new LinkedCell(newcloud, 5.); 528 434 AddFlag = false; 529 435 } 530 Walker = cloud ->GetPoint();436 Walker = cloud.GetPoint(); 531 437 DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl); 532 438 // get the next triangle … … 539 445 if ((BTS == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 540 446 DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl); 541 cloud ->GoToNext();447 cloud.GoToNext(); 542 448 continue; 543 449 } else { … … 610 516 break; 611 517 } 612 cloud ->GoToNext();518 cloud.GoToNext(); 613 519 } 614 520 … … 1122 1028 for (LC->n[map[1]] = 0; LC->n[map[1]] < LC->N[map[1]]; LC->n[map[1]]++) 1123 1029 for (LC->n[map[2]] = 0; LC->n[map[2]] < LC->N[map[2]]; LC->n[map[2]]++) { 1124 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();1030 const TesselPointSTLList *List = LC->GetCurrentCell(); 1125 1031 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1126 1032 if (List != NULL) { 1127 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {1033 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 1128 1034 if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) { 1129 1035 DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl); … … 1982 1888 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 1983 1889 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 1984 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();1890 const TesselPointSTLList *List = LC->GetCurrentCell(); 1985 1891 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1986 1892 if (List != NULL) { 1987 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {1893 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 1988 1894 Candidate = (*Runner); 1989 1895 // check if we only have one unique point yet ... … … 2140 2046 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2141 2047 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2142 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();2048 const TesselPointSTLList *List = LC->GetCurrentCell(); 2143 2049 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2144 2050 if (List != NULL) { 2145 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {2051 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 2146 2052 Candidate = (*Runner); 2147 2053 … … 2313 2219 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 2314 2220 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2315 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();2221 const TesselPointSTLList *List = LC->GetCurrentCell(); 2316 2222 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 2317 2223 if (List != NULL) { 2318 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {2224 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 2319 2225 FindPoint = PointsOnBoundary.find((*Runner)->nr); 2320 2226 if (FindPoint != PointsOnBoundary.end()) { … … 3710 3616 * \param *out otuput stream for debugging 3711 3617 * \param *filename basename of output file 3712 * \param *cloud PointCloud structure with all nodes3713 */ 3714 void Tesselation::Output(const char *filename, const PointCloud * constcloud)3618 * \param *cloud IPointCloud structure with all nodes 3619 */ 3620 void Tesselation::Output(const char *filename, IPointCloud & cloud) 3715 3621 { 3716 3622 Info FunctionInfo(__func__); -
src/tesselation.hpp
rba5215 r34c43a 26 26 #include <stack> 27 27 28 #include "atom_particleinfo.hpp" 28 29 #include "BoundaryMaps.hpp" 29 30 #include "BoundaryPointSet.hpp" 30 #include "PointCloud.hpp"31 #include "TesselPoint.hpp"32 #include "atom_particleinfo.hpp"33 31 #include "Helpers/helpers.hpp" 34 32 #include "LinearAlgebra/Vector.hpp" 33 #include "TesselPoint.hpp" 35 34 36 35 … … 41 40 class BoundaryTriangleSet; 42 41 class CandidateForTesselation; 42 class IPointCloud; 43 43 class LinkedCell; 44 class Plane; 44 45 class Tesselation; 45 class Plane;46 46 47 47 /********************************************** definitions *********************************/ … … 63 63 // =========================================================== class TESSELATION =========================================== 64 64 65 /** Contains the envelope to a PointCloud.65 /** Is iterable container of TesselPoints. 66 66 */ 67 class Tesselation : public PointCloud{67 class Tesselation { 68 68 public: 69 69 … … 97 97 98 98 // convex envelope 99 void TesselateOnBoundary( const PointCloud * constcloud);99 void TesselateOnBoundary(IPointCloud & cloud); 100 100 void GuessStartingTriangle(); 101 bool InsertStraddlingPoints( const PointCloud *cloud, const LinkedCell *LC);101 bool InsertStraddlingPoints(IPointCloud & cloud, const LinkedCell *LC); 102 102 double RemovePointFromTesselatedSurface(class BoundaryPointSet *point); 103 103 class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base); … … 134 134 135 135 // store envelope in file 136 void Output(const char *filename, const PointCloud * constcloud);136 void Output(const char *filename, IPointCloud & cloud); 137 137 138 138 PointMap PointsOnBoundary; … … 146 146 typedef PointMap::iterator iterator; 147 147 typedef PointMap::const_iterator const_iterator; 148 TesselPoint * getValue(const_iterator &rhs) const;149 TesselPoint * getValue(iterator &rhs) const;150 148 iterator begin() { return PointsOnBoundary.begin(); } 151 149 const_iterator begin() const { return PointsOnBoundary.begin(); } 152 150 iterator end() { return PointsOnBoundary.end(); } 153 151 const_iterator end() const { return PointsOnBoundary.end(); } 154 // PointCloud implementation for PointsOnBoundary155 const char * const GetName() const;156 Vector *GetCenter() const;157 TesselPoint *GetPoint() const;158 int GetMaxId() const;159 void GoToNext() const;160 void GoToFirst() const;161 bool IsEmpty() const;162 bool IsEnd() const;163 152 164 153 class BoundaryPointSet *BPS[2]; … … 179 168 }; 180 169 181 182 170 #endif /* TESSELATION_HPP_ */ -
src/tesselationhelpers.cpp
rba5215 r34c43a 28 28 #include "CandidateForTesselation.hpp" 29 29 #include "CodePatterns/Info.hpp" 30 #include "CodePatterns/Log.hpp" 31 #include "CodePatterns/Verbose.hpp" 32 #include "IPointCloud.hpp" 33 #include "LinearAlgebra/Line.hpp" 34 #include "LinearAlgebra/LinearSystemOfEquations.hpp" 35 #include "LinearAlgebra/Plane.hpp" 36 #include "LinearAlgebra/RealSpaceMatrix.hpp" 37 #include "LinearAlgebra/Vector.hpp" 38 #include "LinearAlgebra/vector_ops.hpp" 30 39 #include "linkedcell.hpp" 31 #include "LinearAlgebra/LinearSystemOfEquations.hpp"32 #include "CodePatterns/Log.hpp"33 40 #include "tesselation.hpp" 34 41 #include "tesselationhelpers.hpp" 35 #include "LinearAlgebra/Vector.hpp"36 #include "LinearAlgebra/Line.hpp"37 #include "LinearAlgebra/vector_ops.hpp"38 #include "CodePatterns/Verbose.hpp"39 #include "LinearAlgebra/Plane.hpp"40 #include "LinearAlgebra/RealSpaceMatrix.hpp"41 42 42 43 void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS) … … 427 428 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 428 429 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 429 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();430 const TesselPointSTLList *List = LC->GetCurrentCell(); 430 431 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 431 432 if (List != NULL) { 432 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {433 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 433 434 helper = (Point) - ((*Runner)->getPosition()); 434 435 double currentNorm = helper. Norm(); … … 480 481 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 481 482 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 482 const LinkedCell::LinkedNodes*List = LC->GetCurrentCell();483 const TesselPointSTLList *List = LC->GetCurrentCell(); 483 484 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 484 485 if (List != NULL) { 485 for ( LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {486 for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 486 487 helper = (Point) - ((*Runner)->getPosition()); 487 488 double currentNorm = helper.NormSquared(); … … 569 570 * \param *mol molecule structure with atom positions 570 571 */ 571 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * constcloud)572 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, IPointCloud & cloud) 572 573 { 573 574 Info FunctionInfo(__func__); 574 575 TesselPoint *Walker = NULL; 575 576 int i; 576 Vector *center = cloud ->GetCenter();577 Vector *center = cloud.GetCenter(); 577 578 if (vrmlfile != NULL) { 578 579 //Log() << Verbose(1) << "Writing Raster3D file ... "; … … 580 581 *vrmlfile << "#Created by molecuilder" << endl; 581 582 *vrmlfile << "#All atoms as spheres" << endl; 582 cloud ->GoToFirst();583 while (!cloud ->IsEnd()) {584 Walker = cloud ->GetPoint();583 cloud.GoToFirst(); 584 while (!cloud.IsEnd()) { 585 Walker = cloud.GetPoint(); 585 586 *vrmlfile << "Sphere {" << endl << " "; // 2 is sphere type 586 587 for (i=0;i<NDIM;i++) 587 588 *vrmlfile << Walker->at(i)-center->at(i) << " "; 588 589 *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour 589 cloud ->GoToNext();590 cloud.GoToNext(); 590 591 } 591 592 … … 613 614 * \param *mol molecule structure with atom positions 614 615 */ 615 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * constcloud)616 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, IPointCloud & cloud) 616 617 { 617 618 Info FunctionInfo(__func__); … … 620 621 if (Tess->LastTriangle != NULL) { 621 622 // include the current position of the virtual sphere in the temporary raster3d file 622 Vector *center = cloud ->GetCenter();623 Vector *center = cloud.GetCenter(); 623 624 // make the circumsphere's center absolute again 624 625 Vector helper = (1./3.) * ((Tess->LastTriangle->endpoints[0]->node->getPosition()) + … … 641 642 * \param *mol molecule structure with atom positions 642 643 */ 643 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * constcloud)644 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, IPointCloud & cloud) 644 645 { 645 646 Info FunctionInfo(__func__); 646 647 TesselPoint *Walker = NULL; 647 648 int i; 648 Vector *center = cloud ->GetCenter();649 Vector *center = cloud.GetCenter(); 649 650 if (rasterfile != NULL) { 650 651 //Log() << Verbose(1) << "Writing Raster3D file ... "; … … 652 653 *rasterfile << "@header.r3d" << endl; 653 654 *rasterfile << "# All atoms as spheres" << endl; 654 cloud ->GoToFirst();655 while (!cloud ->IsEnd()) {656 Walker = cloud ->GetPoint();655 cloud.GoToFirst(); 656 while (!cloud.IsEnd()) { 657 Walker = cloud.GetPoint(); 657 658 *rasterfile << "2" << endl << " "; // 2 is sphere type 658 659 for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates … … 661 662 } 662 663 *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour 663 cloud ->GoToNext();664 cloud.GoToNext(); 664 665 } 665 666 … … 691 692 * \param N arbitrary number to differentiate various zones in the tecplot format 692 693 */ 693 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * constcloud, const int N)694 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, IPointCloud & cloud, const int N) 694 695 { 695 696 Info FunctionInfo(__func__); … … 700 701 *tecplot << "ZONE T=\""; 701 702 if (N < 0) { 702 *tecplot << cloud ->GetName();703 *tecplot << cloud.GetName(); 703 704 } else { 704 705 *tecplot << N << "-"; … … 711 712 } 712 713 *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl; 713 const int MaxId=cloud->GetMaxId(); 714 int *LookupList = new int[MaxId]; 715 for (int i=0; i< MaxId ; i++){ 714 const int MaxId=cloud.GetMaxId(); 715 ASSERT(MaxId >= 0, "WriteTecplotFile() - negative MaxId? No atoms present?"); 716 int *LookupList = new int[MaxId+1]; 717 for (int i=0; i<= MaxId ; i++){ 716 718 LookupList[i] = -1; 717 719 } … … 722 724 for (PointMap::const_iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); ++target) { 723 725 Walker = target->second->node; 726 ASSERT(Walker->nr <= MaxId, "WriteTecplotFile() - Id of particle greater than MaxId."); 724 727 LookupList[Walker->nr] = Counter++; 725 728 for (int i=0;i<NDIM;i++) { -
src/tesselationhelpers.hpp
rba5215 r34c43a 34 34 class LinkedCell; 35 35 class TesselPoint; 36 class PointCloud;36 class IPointCloud; 37 37 class Tesselation; 38 38 class Vector; … … 56 56 Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase); 57 57 58 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * constcloud, const int N);59 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * constcloud);60 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation *Tess, const PointCloud *cloud);61 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * constcloud);58 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, IPointCloud & cloud, const int N); 59 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, IPointCloud & cloud); 60 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation *Tess, IPointCloud & cloud); 61 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, IPointCloud & cloud); 62 62 void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct); 63 63 void CalculateConstrictionPerBoundaryPoint(const Tesselation * const TesselStruct, const Tesselation * const Convex); -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
rba5215 r34c43a 27 27 28 28 #include "analysis_correlation.hpp" 29 #include "Descriptors/MoleculeDescriptor.hpp"30 31 29 #include "atom.hpp" 32 30 #include "boundary.hpp" 31 #include "CodePatterns/Assert.hpp" 32 #include "Descriptors/MoleculeDescriptor.hpp" 33 33 #include "element.hpp" 34 34 #include "molecule.hpp" 35 35 #include "linkedcell.hpp" 36 36 #include "periodentafel.hpp" 37 #include "PointCloudAdaptor.hpp" 37 38 #include "tesselation.hpp" 38 39 #include "World.hpp" 39 #include "CodePatterns/Assert.hpp"40 40 41 41 #include "AnalysisCorrelationToSurfaceUnitTest.hpp" … … 100 100 // init tesselation and linked cell 101 101 Surface = new Tesselation; 102 LC = new LinkedCell(*TestSurfaceMolecule, 5.); 102 PointCloudAdaptor<molecule> cloud(TestSurfaceMolecule); 103 LC = new LinkedCell(cloud, 5.); 103 104 FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL); 104 105 -
src/unittests/LinkedCellUnitTest.cpp
rba5215 r34c43a 29 29 30 30 #include "atom.hpp" 31 #include "Descriptors/MoleculeDescriptor.hpp" 31 32 #include "element.hpp" 32 33 #include "linkedcell.hpp" 33 34 #include "molecule.hpp" 34 35 #include "periodentafel.hpp" 36 #include "PointCloudAdaptor.hpp" 35 37 #include "World.hpp" 36 38 … … 69 71 70 72 // construct linked cell 71 LC = new LinkedCell (*TestMolecule, 1.); 73 PointCloudAdaptor<molecule> cloud(TestMolecule); 74 LC = new LinkedCell (cloud, 1.); 72 75 CPPUNIT_ASSERT(LC != NULL && "could not create LinkedCell"); 73 76 … … 121 124 // within bounds 122 125 LC->n[0] = LC->n[1] = LC->n[2] = 0; 123 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0 * 3*3 + 0 * 3 + 0], LC->GetCurrentCell() );124 LC->n[0] = LC->n[1] = LC->n[2] = 1; 125 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[1 * 3*3 + 1 * 3 + 1], LC->GetCurrentCell() );126 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0 * 3*3 + 0 * 3 + 0], LC->GetCurrentCell() ); 127 LC->n[0] = LC->n[1] = LC->n[2] = 1; 128 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[1 * 3*3 + 1 * 3 + 1], LC->GetCurrentCell() ); 126 129 LC->n[0] = LC->n[1] = LC->n[2] = 2; 127 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetCurrentCell() );130 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetCurrentCell() ); 128 131 129 132 // out of bounds 130 133 LC->n[0] = LC->n[1] = LC->n[2] = 3; 131 134 cout << "The following test is supposed to fail and produce an ERROR." << endl; 132 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetCurrentCell() );135 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetCurrentCell() ); 133 136 LC->n[0] = LC->n[1] = LC->n[2] = -1; 134 137 cout << "The following test is supposed to fail and produce an ERROR." << endl; 135 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetCurrentCell() );138 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetCurrentCell() ); 136 139 }; 137 140 … … 145 148 offset[0] = offset[1] = offset[2] = 0; 146 149 LC->n[0] = LC->n[1] = LC->n[2] = 0; 147 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );150 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); 148 151 offset[0] = offset[1] = offset[2] = -1; 149 152 LC->n[0] = LC->n[1] = LC->n[2] = 1; 150 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );153 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); 151 154 offset[0] = offset[1] = offset[2] = -2; 152 155 LC->n[0] = LC->n[1] = LC->n[2] = 2; 153 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) );156 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); 154 157 155 158 // offset to (0,0,0) - 1.*(x/y/z) out of bounds … … 158 161 LC->n[0] = LC->n[1] = LC->n[2] = 0; 159 162 cout << "The following test is supposed to fail and produce an ERROR." << endl; 160 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );163 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 161 164 offset[0] = offset[1] = offset[2] = 0; 162 165 offset[1] = -1; 163 166 LC->n[0] = LC->n[1] = LC->n[2] = 0; 164 167 cout << "The following test is supposed to fail and produce an ERROR." << endl; 165 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );168 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 166 169 offset[0] = offset[1] = offset[2] = 0; 167 170 offset[2] = -1; 168 171 LC->n[0] = LC->n[1] = LC->n[2] = 0; 169 172 cout << "The following test is supposed to fail and produce an ERROR." << endl; 170 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );173 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 171 174 172 175 // out of bounds … … 174 177 LC->n[0] = LC->n[1] = LC->n[2] = 1; 175 178 cout << "The following test is supposed to fail and produce an ERROR." << endl; 176 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );179 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 177 180 offset[0] = offset[1] = offset[2] = 192345; 178 181 LC->n[0] = LC->n[1] = LC->n[2] = 1; 179 182 cout << "The following test is supposed to fail and produce an ERROR." << endl; 180 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );183 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 181 184 182 185 // index is out of bounds, offset points within 183 186 offset[0] = offset[1] = offset[2] = -2; 184 187 LC->n[0] = LC->n[1] = LC->n[2] = 4; 185 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetRelativeToCurrentCell(offset) );188 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetRelativeToCurrentCell(offset) ); 186 189 187 190 // index is within bounds, offset points out … … 189 192 LC->n[0] = LC->n[1] = LC->n[2] = 2; 190 193 cout << "The following test is supposed to fail and produce an ERROR." << endl; 191 CPPUNIT_ASSERT_EQUAL( (const LinkedCell::LinkedNodes*)NULL, LC->GetRelativeToCurrentCell(offset) );194 CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); 192 195 }; 193 196 … … 276 279 { 277 280 Vector tester; 278 LinkedCell::LinkedNodes*ListOfPoints = NULL;281 TesselPointSTLList *ListOfPoints = NULL; 279 282 size_t size = 0; 280 283 … … 337 340 { 338 341 Vector tester; 339 LinkedCell::LinkedNodes*ListOfPoints = NULL;342 TesselPointSTLList *ListOfPoints = NULL; 340 343 size_t size = 0; 341 344 -
src/unittests/TesselationUnitTest.cpp
rba5215 r34c43a 26 26 #include <cstring> 27 27 28 #include "Helpers/defs.hpp"29 #include "TesselPoint.hpp"30 28 #include "BoundaryLineSet.hpp" 31 29 #include "BoundaryTriangleSet.hpp" 32 30 #include "CandidateForTesselation.hpp" 31 #include "Helpers/defs.hpp" 32 #include "PointCloudAdaptor.hpp" 33 #include "TesselPoint.hpp" 33 34 34 35 #include "TesselationUnitTest.hpp" … … 72 73 73 74 // create linkedcell 74 LinkedList = new LinkedCell(Corners, 2.*SPHERERADIUS); 75 PointCloudAdaptor<TesselPointSTLList> cloud(&Corners); 76 LinkedList = new LinkedCell(cloud, 2.*SPHERERADIUS); 75 77 76 78 // create tesselation … … 116 118 delete(LinkedList); 117 119 delete(TesselStruct); 118 for ( LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)120 for (TesselPointSTLList::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) 119 121 delete(*Runner); 120 122 Corners.clear(); -
src/unittests/TesselationUnitTest.hpp
rba5215 r34c43a 42 42 43 43 class Tesselation *TesselStruct; 44 LinkedCell::LinkedNodesCorners;44 TesselPointSTLList Corners; 45 45 class LinkedCell *LinkedList; 46 46 }; -
src/unittests/Tesselation_BoundaryTriangleUnitTest.hpp
rba5215 r34c43a 46 46 class BoundaryPointSet *points[3]; 47 47 class TesselPoint *tesselpoints[3]; 48 LinkedCell::LinkedNodesCorners;48 TesselPointSTLList Corners; 49 49 }; 50 50 -
src/unittests/Tesselation_InsideOutsideUnitTest.cpp
rba5215 r34c43a 27 27 #include <iostream> 28 28 29 #include "Helpers/defs.hpp"30 #include "TesselPoint.hpp"31 29 #include "BoundaryLineSet.hpp" 32 30 #include "BoundaryTriangleSet.hpp" 33 31 #include "CandidateForTesselation.hpp" 34 32 #include "CodePatterns/Verbose.hpp" 33 #include "Helpers/defs.hpp" 34 #include "PointCloudAdaptor.hpp" 35 #include "TesselPoint.hpp" 35 36 36 37 #include "Tesselation_InsideOutsideUnitTest.hpp" … … 95 96 96 97 // create linkedcell 97 LinkedList = new LinkedCell(Corners, 2.*SPHERERADIUS); 98 PointCloudAdaptor< TesselPointSTLList > cloud(&Corners); 99 LinkedList = new LinkedCell(cloud, 2.*SPHERERADIUS); 98 100 99 101 // create tesselation … … 146 148 delete(LinkedList); 147 149 delete(TesselStruct); 148 for ( LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)150 for (TesselPointSTLList::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) 149 151 delete(*Runner); 150 152 Corners.clear(); -
src/unittests/Tesselation_InsideOutsideUnitTest.hpp
rba5215 r34c43a 39 39 40 40 class Tesselation *TesselStruct; 41 LinkedCell::LinkedNodesCorners;41 TesselPointSTLList Corners; 42 42 class LinkedCell *LinkedList; 43 43 }; -
tests/regression/Tesselation/BigConvex/testsuite-tesselation-big-convex-envelope.at
rba5215 r34c43a 2 2 3 3 AT_SETUP([Tesselation - big convex Envelope]) 4 AT_KEYWORDS([Tesselation,convex]) 4 5 AT_XFAIL_IF([/bin/true]) 5 AT_KEYWORDS([Tesselation])6 6 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/BigConvex/pre/* .], 0) 7 7 AT_CHECK([../../molecuilder -i test.conf --select-molecule-by-id 0 --convex-envelope --convex-file ConvexEnvelope --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) -
tests/regression/Tesselation/BigNonConvex/testsuite-tesselation-big-non-convex-envelope.at
rba5215 r34c43a 2 2 3 3 AT_SETUP([Tesselation - Big non-Convex Envelope]) 4 AT_KEYWORDS([Tesselation,nonconvex]) 5 AT_XFAIL_IF([/bin/true]) 4 6 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/BigNonConvex/pre/* .], 0) 5 7 AT_CHECK([../../molecuilder -i test.conf --select-molecule-by-id 0 -N 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) -
tests/regression/Tesselation/Convex/testsuite-tesselation-convex-envelope.at
rba5215 r34c43a 2 2 3 3 AT_SETUP([Tesselation - Convex Envelope]) 4 AT_KEYWORDS([Tesselation,convex]) 5 AT_XFAIL_IF([/bin/true]) 4 6 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/Convex/pre/* .], 0) 5 7 AT_CHECK([../../molecuilder -i test.conf --select-molecule-by-id 0 --convex-envelope --convex-file ConvexEnvelope --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr]) -
tests/regression/Tesselation/NonConvex/testsuite-tesselation-non-convex-envelope.at
rba5215 r34c43a 2 2 3 3 AT_SETUP([Tesselation - Non-Convex Envelope]) 4 AT_KEYWORDS([Tesselation]) 4 AT_KEYWORDS([Tesselation,nonconvex]) 5 AT_XFAIL_IF([/bin/true]) 5 6 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/NonConvex/pre/* .], 0) 6 7 AT_CHECK([../../molecuilder -i test.conf --select-molecule-by-id 0 -N 4. --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])
Note:
See TracChangeset
for help on using the changeset viewer.