Changeset 4f041a4 for src


Ignore:
Timestamp:
Nov 15, 2012, 5:29:43 PM (12 years ago)
Author:
Frederik Heber <heber@…>
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:
4477b7
Parents:
6e5d35
git-author:
Michael Ankele <ankele@…> (09/05/12 14:11:12)
git-committer:
Frederik Heber <heber@…> (11/15/12 17:29:43)
Message:

ShapeFactory: factory state

Location:
src/Shapes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Shapes/ShapeFactory.cpp

    r6e5d35 r4f041a4  
    3434
    3535#include "CodePatterns/MemDebug.hpp"
    36 #include "CodePatterns/Log.hpp"
    3736
    3837#include "ShapeFactory.hpp"
     
    5150  for (int i=0; i<SHAPETYPES_MAX; i++)
    5251    nameShapeMap.insert(std::pair<std::string, ShapeType>(shapeNames[i], (ShapeType)i));
     52
     53  // Init state.
     54  type = SPHERE;
     55  translation.Zero();
     56  stretch.Zero();
     57  for (int i=0; i<NDIM; i++)
     58    angle[i] = 0;
    5359}
    5460
     
    7379}
    7480
     81
     82void ShapeFactory::setStretch(const Vector &stretch)
     83{
     84  ASSERT(!stretch.IsZero(),
     85      "ShapeFactory::setStretch() - stretch is zero.");
     86  this->stretch = stretch;
     87}
     88
    7589CONSTRUCT_SINGLETON(ShapeFactory)
  • src/Shapes/ShapeFactory.hpp

    r6e5d35 r4f041a4  
    1616
    1717#include "CodePatterns/Singleton.hpp"
     18#include "LinearAlgebra/Vector.hpp"
    1819
    1920class ShapeFactory : public Singleton<ShapeFactory>
     
    2930  std::string getShapeName(ShapeType type);
    3031
     32
     33  // setters/getters for the current state
     34  const double* getAngle() const { return angle; }
     35  void setAngle(double angleX, double angleY, double angleZ) { angle[0] = angleX; angle[1] = angleY; angle[2] = angleZ; }
     36
     37  Vector getStretch() const { return stretch; }
     38  void setStretch(const Vector &stretch);
     39
     40  Vector getTranslation() const { return translation; }
     41  void setTranslation(const Vector &translation) { this->translation = translation; }
     42
     43  ShapeType getType() const { return type; }
     44  void setType(ShapeType type) { this->type = type; }
     45
    3146private:
    3247  // private constructor and destructor due to singleton
     
    3449  virtual ~ShapeFactory();
    3550
     51  // name/type maps
    3652  static const char *shapeNames[];
    3753  typedef std::map<ShapeType, std::string> ShapeNameMap;
     
    3955  typedef std::map<std::string,ShapeType> NameShapeMap;
    4056  NameShapeMap nameShapeMap;
     57
     58  // current state
     59  ShapeType type;
     60  Vector translation;
     61  Vector stretch;
     62  double angle[NDIM];
    4163};
    4264
Note: See TracChangeset for help on using the changeset viewer.