Changeset d61161 for src/Shapes
- Timestamp:
- Nov 19, 2012, 10:27:51 AM (12 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:
- d5307b
- Parents:
- 286a967 (diff), 315351 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Shapes
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/BaseShapes.cpp
r286a967 rd61161 61 61 62 62 bool Cylinder_impl::isOnSurface(const Vector &point) const { 63 return fabs(Vector(point[0], point[1], 0.0).NormSquared()-1.0)<MYEPSILON && 64 (point[2] > -1.0-MYEPSILON) && (point[2] < 1.0+MYEPSILON); 63 // on the side? 64 if (fabs(Vector(point[0], point[1], 0.0).NormSquared()-1.0)<MYEPSILON && 65 (point[2] > -1.0-MYEPSILON) && (point[2] < 1.0+MYEPSILON)) 66 return true; 67 // on top/bottom? 68 if ((Vector(point[0], point[1], 0.0).NormSquared()< 1.0 + MYEPSILON) && 69 ((fabs(point[2]-1)<MYEPSILON) || (fabs(point[2]+1)<MYEPSILON))) 70 return true; 71 return false; 65 72 66 73 } … … 71 78 } 72 79 73 if ((fabs(point[2]-1)<MYEPSILON) || (fabs(point[2])<MYEPSILON)) 74 return Vector(0.0, 0.0, point[2]); 80 Vector n = Vector(0, 0, 0); 81 if ((fabs(point[2]-1)<MYEPSILON) || (fabs(point[2]+1)<MYEPSILON)) 82 n += Vector(0.0, 0.0, point[2]); 75 83 else 76 return Vector(point[0], point[1], 0.0); 84 n += Vector(point[0], point[1], 0.0); 85 n.Normalize(); 86 return n; 77 87 } 78 88 … … 109 119 std::vector<double> solutions; 110 120 111 // Common routine to solve quadratic quations, anywhere?121 // Common routine to solve quadratic equations, anywhere? 112 122 const double neg_p_half = -B/(2.0*A); 113 123 const double q = C/A; … … 168 178 169 179 for(int useg=0; useg<nu; useg++) 170 for(int zseg=0; zseg< nz; zseg++)180 for(int zseg=0; zseg<=nz; zseg++) 171 181 result.push_back(Vector(cos(useg*dphi), sin(useg*dphi), zseg*dz-1.0)); 172 182 … … 366 376 // figure out on which sides the Vector lies (maximum 3, when it is in a corner) 367 377 for(int i=NDIM;i--;){ 368 if( fabs(fabs(point[i])-1)<MYEPSILON){378 if((fabs(point[i])<MYEPSILON) || (fabs(point[i]-1)<MYEPSILON)){ 369 379 // add the scaled (-1/+1) Vector to the set of surface vectors 370 res[i] = point[i] ;380 res[i] = point[i] * 2.0 - 1.0; 371 381 } 372 382 } … … 442 452 std::vector<Vector> Cuboid_impl::getHomogeneousPointsOnSurface(const size_t N) const { 443 453 std::vector<Vector> PointsOnSurface; 444 ASSERT(false, "Cuboid_impl::getHomogeneousPointsOnSurface() not implemented yet"); 454 // sides 455 int n = sqrt((N - 1) / 6) + 1; 456 for (int i=0; i<=n; i++){ 457 double ii = (double)i / (double)n; 458 for (int k=0; k<n; k++){ 459 double kk = (double)k / (double)n; 460 PointsOnSurface.push_back(Vector(ii, kk, 1)); 461 PointsOnSurface.push_back(Vector(ii, 1, 1-kk)); 462 PointsOnSurface.push_back(Vector(ii, 1-kk, 0)); 463 PointsOnSurface.push_back(Vector(ii, 0, kk)); 464 } 465 } 466 // top and bottom 467 for (int i=1; i<n; i++){ 468 double ii = (double)i / (double)n; 469 for (int k=1; k<n; k++){ 470 double kk = (double)k / (double)n; 471 PointsOnSurface.push_back(Vector(0, ii, kk)); 472 PointsOnSurface.push_back(Vector(1, ii, kk)); 473 } 474 } 445 475 return PointsOnSurface; 446 476 } -
src/Shapes/Makefile.am
r286a967 rd61161 5 5 Shapes/BaseShapes.cpp \ 6 6 Shapes/Shape.cpp \ 7 Shapes/ShapeOps.cpp 7 Shapes/ShapeFactory.cpp \ 8 Shapes/ShapeOps.cpp \ 9 Shapes/ShapeRegistry.cpp 8 10 SHAPEHEADER = \ 9 11 Shapes/BaseShapes.hpp \ … … 12 14 Shapes/Shape_impl.hpp \ 13 15 Shapes/ShapeExceptions.hpp \ 16 Shapes/ShapeFactory.hpp \ 14 17 Shapes/ShapeOps.hpp \ 15 18 Shapes/ShapeOps_impl.hpp \ 19 Shapes/ShapeRegistry.hpp \ 16 20 Shapes/ShapeType.hpp 17 21 -
src/Shapes/Shape.cpp
r286a967 rd61161 52 52 53 53 Shape::Shape(const Shape& src) : 54 impl(src.getImpl()) 54 impl(src.getImpl()), name(src.getName()) 55 55 {} 56 56 … … 75 75 double Shape::getRadius() const{ 76 76 return impl->getRadius(); 77 } 78 79 void Shape::setName(const std::string &_name){ 80 name = _name; 81 } 82 83 std::string Shape::getName() const{ 84 return name; 77 85 } 78 86 -
src/Shapes/Shape.hpp
r286a967 rd61161 58 58 enum ShapeType getType() const; 59 59 60 void setName(const std::string &_name); 61 std::string getName() const; 62 60 63 protected: 61 64 impl_ptr getImpl() const; … … 63 66 private: 64 67 impl_ptr impl; 68 std::string name; 65 69 }; 66 70 -
src/Shapes/ShapeType.hpp
r286a967 rd61161 22 22 PolygonType, 23 23 CombinedType, 24 MAX_ShapeType,25 CylinderType24 CylinderType, 25 MAX_ShapeType 26 26 }; 27 27 -
src/Shapes/unittests/Makefile.am
r286a967 rd61161 5 5 SHAPETESTSSOURCES = \ 6 6 ../Shapes/unittests/BaseShapesUnitTest.cpp \ 7 ../Shapes/unittests/ShapeFactoryUnitTest.cpp \ 7 8 ../Shapes/unittests/ShapeOpsUnitTest.cpp \ 9 ../Shapes/unittests/ShapeRegistryUnitTest.cpp \ 8 10 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp 9 11 10 12 SHAPETESTSHEADERS= \ 11 13 ../Shapes/unittests/BaseShapesUnitTest.hpp \ 14 ../Shapes/unittests/ShapeFactoryUnitTest.hpp \ 12 15 ../Shapes/unittests/ShapeOpsUnitTest.hpp \ 16 ../Shapes/unittests/ShapeRegistryUnitTest.hpp \ 13 17 ../Shapes/unittests/Shape_HomogeneousPointsUnitTest.cpp 14 18 15 19 SHAPETESTS = \ 16 20 BaseShapesUnitTest \ 21 ShapeFactoryUnitTest \ 17 22 ShapeOpsUnitTest \ 23 ShapeRegistryUnitTest \ 18 24 Shape_HomogeneousPointsUnitTest 19 25 … … 38 44 BaseShapesUnitTest_LDADD = $(SHAPELIBS) 39 45 46 ShapeFactoryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 47 ../Shapes/unittests/ShapeFactoryUnitTest.cpp \ 48 ../Shapes/unittests/ShapeFactoryUnitTest.hpp \ 49 ../Shapes/unittests/stubs/ApproximateShapeAreaStub.cpp \ 50 ../Shapes/unittests/stubs/ApproximateShapeVolumeStub.cpp 51 nodist_ShapeFactoryUnitTest_SOURCES = \ 52 ../Helpers/defs.hpp \ 53 ../Helpers/defs.cpp 54 ShapeFactoryUnitTest_LDADD = $(SHAPELIBS) 55 40 56 ShapeOpsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 41 57 ../Shapes/unittests/ShapeOpsUnitTest.cpp \ … … 47 63 ../Helpers/defs.cpp 48 64 ShapeOpsUnitTest_LDADD = $(SHAPELIBS) 65 66 ShapeRegistryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 67 ../Shapes/unittests/ShapeRegistryUnitTest.cpp \ 68 ../Shapes/unittests/ShapeRegistryUnitTest.hpp \ 69 ../Shapes/unittests/stubs/ApproximateShapeAreaStub.cpp \ 70 ../Shapes/unittests/stubs/ApproximateShapeVolumeStub.cpp 71 nodist_ShapeRegistryUnitTest_SOURCES = \ 72 ../Helpers/defs.hpp \ 73 ../Helpers/defs.cpp 74 ShapeRegistryUnitTest_LDADD = $(SHAPELIBS) 49 75 50 76 Shape_HomogeneousPointsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
Note:
See TracChangeset
for help on using the changeset viewer.