- Timestamp:
- Jul 15, 2010, 10:37:56 AM (15 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:
- 4506cc
- Parents:
- ef84ca
- Location:
- src/Shapes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/BaseShapes.cpp
ref84ca rcfda65 27 27 } 28 28 return point; 29 } 30 31 string Sphere_impl::toString(){ 32 return "Sphere()"; 29 33 } 30 34 … … 67 71 } 68 72 73 string Cuboid_impl::toString(){ 74 return "Cuboid()"; 75 } 76 69 77 Shape Cuboid(){ 70 78 Shape::impl_ptr impl = Shape::impl_ptr(new Cuboid_impl()); -
src/Shapes/BaseShapes_impl.hpp
ref84ca rcfda65 15 15 virtual bool isOnSurface(const Vector &point); 16 16 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException); 17 virtual std::string toString(); 17 18 }; 18 19 … … 21 22 virtual bool isOnSurface(const Vector &point); 22 23 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException); 24 virtual std::string toString(); 23 25 }; 24 26 -
src/Shapes/Shape.cpp
ref84ca rcfda65 11 11 #include "Helpers/Assert.hpp" 12 12 13 #include <string> 14 15 using namespace std; 16 13 17 Shape::Shape(const Shape& src) : 14 18 impl(src.getImpl()) … … 38 42 } 39 43 return *this; 44 } 45 46 std::string Shape::toString() const{ 47 return impl->toString(); 40 48 } 41 49 … … 118 126 } 119 127 128 string AndShape_impl::toString(){ 129 return string("(") + lhs->toString() + string("&&") + rhs->toString() + string(")"); 130 } 131 120 132 Shape operator&&(const Shape &lhs,const Shape &rhs){ 121 133 Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 178 190 } 179 191 192 string OrShape_impl::toString(){ 193 return string("(") + lhs->toString() + string("||") + rhs->toString() + string(")"); 194 } 195 180 196 Shape operator||(const Shape &lhs,const Shape &rhs){ 181 197 Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 203 219 } 204 220 221 string NotShape_impl::toString(){ 222 return string("!") + arg->toString(); 223 } 224 205 225 Shape operator!(const Shape &arg){ 206 226 Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg))); 207 227 return Shape(newImpl); 208 228 } 229 230 /**************** global operations *********************************/ 231 ostream &operator<<(ostream &ost,const Shape &shape){ 232 ost << shape.toString(); 233 return ost; 234 } -
src/Shapes/Shape.hpp
ref84ca rcfda65 10 10 11 11 #include <boost/shared_ptr.hpp> 12 #include <iosfwd> 12 13 13 14 #include "Exceptions/NotOnSurfaceException.hpp" … … 32 33 Shape &operator=(const Shape& rhs); 33 34 35 std::string toString() const; 34 36 protected: 35 37 impl_ptr getImpl() const; … … 46 48 Shape operator!(const Shape&); 47 49 50 std::ostream &operator<<(std::ostream&,const Shape&); 51 48 52 #endif /* SHAPE_HPP_ */ -
src/Shapes/ShapeOps.cpp
ref84ca rcfda65 34 34 } 35 35 36 Shape::impl_ptr ShapeOpsBase_impl::getArg(){ 37 return arg; 38 } 39 36 40 /********************* Resize ********************/ 37 41 … … 54 58 Vector Resize_impl::translateOutNormal(const Vector& point){ 55 59 return point; 60 } 61 62 string Resize_impl::toString(){ 63 stringstream sstr; 64 sstr << "resize(" << getArg()->toString() << "," << size << ")"; 65 return sstr.str(); 56 66 } 57 67 … … 79 89 Vector Translate_impl::translateOutNormal(const Vector& point){ 80 90 return point; 91 } 92 93 string Translate_impl::toString(){ 94 stringstream sstr; 95 sstr << "translate(" << getArg()->toString() << "," << offset << ")"; 81 96 } 82 97 … … 125 140 } 126 141 142 string Stretch_impl::toString(){ 143 stringstream sstr; 144 sstr << "stretch(" << getArg()->toString() << "," << factors << ")"; 145 return sstr.str(); 146 } 147 127 148 Shape stretch(const Shape &arg, const Vector &factors){ 128 149 Shape::impl_ptr impl = Shape::impl_ptr(new Stretch_impl(getShapeImpl(arg),factors)); … … 153 174 } 154 175 176 string Transform_impl::toString(){ 177 stringstream sstr; 178 sstr << "transform(" << getArg()->toString() << "," << transformation << ")"; 179 return sstr.str(); 180 } 181 155 182 Shape transform(const Shape &arg, const Matrix &transformation){ 156 183 Shape::impl_ptr impl = Shape::impl_ptr(new Transform_impl(getShapeImpl(arg),transformation)); -
src/Shapes/ShapeOps_impl.hpp
ref84ca rcfda65 24 24 virtual Vector translateOutPos(const Vector &point)=0; 25 25 virtual Vector translateOutNormal(const Vector &point)=0; 26 Shape::impl_ptr getArg(); 26 27 private: 27 28 Shape::impl_ptr arg; … … 37 38 virtual Vector translateOutPos(const Vector &point); 38 39 virtual Vector translateOutNormal(const Vector &point); 40 virtual std::string toString(); 39 41 private: 40 42 double size; … … 50 52 virtual Vector translateOutPos(const Vector &point); 51 53 virtual Vector translateOutNormal(const Vector &point); 54 virtual std::string toString(); 52 55 private: 53 56 Vector offset; … … 63 66 virtual Vector translateOutPos(const Vector &point); 64 67 virtual Vector translateOutNormal(const Vector &point); 68 virtual std::string toString(); 65 69 private: 66 70 Vector factors; … … 77 81 virtual Vector translateOutPos(const Vector &point); 78 82 virtual Vector translateOutNormal(const Vector &point); 83 virtual std::string toString(); 79 84 private: 80 85 Matrix transformation; -
src/Shapes/Shape_impl.hpp
ref84ca rcfda65 19 19 virtual bool isOnSurface(const Vector &point)=0; 20 20 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException)=0; 21 virtual std::string toString()=0; 21 22 }; 22 23 … … 32 33 throw NotOnSurfaceException(__FILE__,__LINE__); 33 34 } 35 virtual std::string toString(){ 36 return "Everywhere()"; 37 } 34 38 }; 35 39 … … 44 48 throw NotOnSurfaceException(__FILE__,__LINE__); 45 49 } 50 virtual std::string toString(){ 51 return "Nowhere()"; 52 } 46 53 }; 47 54 … … 53 60 virtual bool isOnSurface(const Vector &point); 54 61 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException); 62 virtual std::string toString(); 55 63 private: 56 64 Shape::impl_ptr lhs; … … 65 73 virtual bool isOnSurface(const Vector &point); 66 74 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException); 75 virtual std::string toString(); 67 76 private: 68 77 Shape::impl_ptr lhs; … … 77 86 virtual bool isOnSurface(const Vector &point); 78 87 virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException); 88 virtual std::string toString(); 79 89 private: 80 90 Shape::impl_ptr arg;
Note:
See TracChangeset
for help on using the changeset viewer.