Changeset e9b8bb


Ignore:
Timestamp:
Aug 6, 2008, 9:02:01 AM (16 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:
5e0d1f
Parents:
d7e30c
Message:

Rename of class vector to Vector to avoid conflict with vector from STL.

Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    rd7e30c re9b8bb  
    151151};
    152152
    153 void BoundaryTriangleSet::GetNormalVector(vector &NormalVector)
     153void BoundaryTriangleSet::GetNormalVector(Vector &NormalVector)
    154154{
    155155  // get normal vector
     
    211211  Boundaries *BoundaryPoints = new Boundaries [NDIM];  // first is alpha, second is (r, nr)
    212212  BoundariesTestPair BoundaryTestPair;
    213   vector AxisVector, AngleReferenceVector, AngleReferenceNormalVector;
     213  Vector AxisVector, AngleReferenceVector, AngleReferenceNormalVector;
    214214  double radius, angle;
    215215  // 3a. Go through every axis
     
    233233    while (Walker->next != mol->end) {
    234234      Walker = Walker->next;
    235       vector ProjectedVector;
     235      Vector ProjectedVector;
    236236      ProjectedVector.CopyVector(&Walker->x);
    237237      ProjectedVector.ProjectOntoPlane(&AxisVector);
     
    316316        // construct the vector of each side of the triangle on the projected plane (defined by normal vector AxisVector)
    317317        {
    318           vector SideA, SideB, SideC, SideH;
     318          Vector SideA, SideB, SideC, SideH;
    319319          SideA.CopyVector(&left->second.second->x);
    320320          SideA.ProjectOntoPlane(&AxisVector);
     
    394394    GreatestDiameter[i] = 0.;
    395395  double OldComponent, tmp, w1, w2;
    396   vector DistanceVector, OtherVector;
     396  Vector DistanceVector, OtherVector;
    397397  int component, Othercomponent;
    398398  for(int axis=0;axis<NDIM;axis++) { // regard each projected plane
     
    470470  double PyramidVolume = 0.;
    471471  double G,h;
    472   vector x,y;
     472  Vector x,y;
    473473  double a,b,c;
    474474
    475475  // 1. calculate center of gravity
    476476  *out << endl;
    477   vector *CenterOfGravity = mol->DetermineCenterOfGravity(out);
     477  Vector *CenterOfGravity = mol->DetermineCenterOfGravity(out);
    478478 
    479479  // 2. translate all points into CoG
     
    578578    clustervolume = ClusterVolume;
    579579  double *GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, IsAngstroem);
    580   vector BoxLengths;
     580  Vector BoxLengths;
    581581  int repetition[NDIM] = {1, 1, 1};
    582582  int TotalNoClusters = 1;
     
    755755  class BoundaryPointSet *peak = NULL;
    756756  double SmallestAngle, TempAngle;
    757   vector NormalVector, VirtualNormalVector, CenterVector, TempVector, PropagationVector;
     757  Vector NormalVector, VirtualNormalVector, CenterVector, TempVector, PropagationVector;
    758758  LineMap::iterator LineChecker[2];
    759759  do {
  • src/boundary.hpp

    rd7e30c re9b8bb  
    8888    ~BoundaryTriangleSet();
    8989   
    90     void GetNormalVector(vector &NormalVector);
     90    void GetNormalVector(Vector &NormalVector);
    9191   
    9292    class BoundaryPointSet *endpoints[3];
  • src/builder.cpp

    rd7e30c re9b8bb  
    6363{
    6464  atom *first, *second, *third, *fourth;
    65   vector **atoms;
    66   vector x,y,z,n;  // coordinates for absolute point in cell volume
     65  Vector **atoms;
     66  Vector x,y,z,n;  // coordinates for absolute point in cell volume
    6767  double a,b,c;
    6868  char choice;  // menu choice char
     
    9999          cout << Verbose(0) << "Enter relative coordinates." << endl;
    100100          first->x.AskPosition(mol->cell_size, false);
    101           first->x.AddVector((const vector *)&x);
     101          first->x.AddVector((const Vector *)&x);
    102102          cout << Verbose(0) << "\n";
    103         } while (!(valid = mol->CheckBounds((const vector *)&first->x)));
     103        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    104104        first->type = periode->AskElement();  // give type
    105105        mol->AddAtom(first);  // add to molecule
     
    117117            first->x.x[i] += second->x.x[i];
    118118          }
    119         } while (!(valid = mol->CheckBounds((const vector *)&first->x)));
     119        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    120120        first->type = periode->AskElement();  // give type
    121121        mol->AddAtom(first);  // add to molecule
     
    219219          first->x.Output((ofstream *)&cout);
    220220          cout << Verbose(0) << endl;
    221         } while (!(valid = mol->CheckBounds((const vector *)&first->x)));
     221        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    222222        first->type = periode->AskElement();  // give type
    223223        mol->AddAtom(first);  // add to molecule
     
    226226      case 'e': // least square distance position to a set of atoms
    227227        first = new atom;
    228         atoms = new (vector*[128]);
     228        atoms = new (Vector*[128]);
    229229        valid = true;
    230230        for(int i=128;i--;)
     
    259259static void CenterAtoms(molecule *mol)
    260260{
    261   vector x, y;
     261  Vector x, y;
    262262  char choice;  // menu choice char
    263263 
     
    315315{
    316316  atom *first, *second, *third;
    317   vector x,n;
     317  Vector x,n;
    318318  char choice;  // menu choice char
    319319
     
    335335      third = mol->AskAtom("Enter third atom: ");
    336336
    337       n.MakeNormalVector((const vector *)&first->x,(const vector *)&second->x,(const vector *)&third->x);
     337      n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
    338338      break;
    339339    case 'b': // normal vector of mirror plane
     
    346346      second = mol->AskAtom("Enter second atom: ");
    347347
    348       n.CopyVector((const vector *)&first->x); 
    349       n.SubtractVector((const vector *)&second->x); 
     348      n.CopyVector((const Vector *)&first->x); 
     349      n.SubtractVector((const Vector *)&second->x); 
    350350      n.Normalize();
    351351      break;       
    352352    case 'd':
    353353      char shorthand[4];
    354       vector a;
     354      Vector a;
    355355      struct lsq_params param;
    356356      do {
     
    383383{
    384384  atom *first, *second, *third;
    385   vector n;
     385  Vector n;
    386386  char choice;  // menu choice char
    387387 
     
    402402      third = mol->AskAtom("Enter third atom: ");
    403403
    404       n.MakeNormalVector((const vector *)&first->x,(const vector *)&second->x,(const vector *)&third->x);
     404      n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
    405405      break;
    406406    case 'b': // normal vector of mirror plane
     
    413413      second = mol->AskAtom("Enter second atom: ");
    414414
    415       n.CopyVector((const vector *)&first->x); 
    416       n.SubtractVector((const vector *)&second->x); 
     415      n.CopyVector((const Vector *)&first->x); 
     416      n.SubtractVector((const Vector *)&second->x); 
    417417      n.Normalize();
    418418      break;         
     
    421421  n.Output((ofstream *)&cout);
    422422  cout << Verbose(0) << endl;
    423   mol->Mirror((const vector *)&n);
     423  mol->Mirror((const Vector *)&n);
    424424};
    425425
     
    458458      while(first->next != mol->end) {
    459459        first = first->next;
    460         if (first->x.Distance((const vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
     460        if (first->x.Distance((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
    461461          mol->RemoveAtom(first);
    462462      }
     
    488488{
    489489  atom *first, *second, *third;
    490   vector x,y;
     490  Vector x,y;
    491491  double min[256], tmp1, tmp2, tmp3;
    492492  int Z;
     
    519519        tmp1 = 0.;
    520520        if (first != second) {
    521           x.CopyVector((const vector *)&first->x);
    522           x.SubtractVector((const vector *)&second->x);
     521          x.CopyVector((const Vector *)&first->x);
     522          x.SubtractVector((const Vector *)&second->x);
    523523          tmp1 = x.Norm();
    524524        }
     
    535535      for (int i=NDIM;i--;)
    536536        min[i] = 0.;
    537       x.CopyVector((const vector *)&first->x);
    538       x.SubtractVector((const vector *)&second->x);
     537      x.CopyVector((const Vector *)&first->x);
     538      x.SubtractVector((const Vector *)&second->x);
    539539      tmp1 = x.Norm();
    540540      cout << Verbose(1) << "Distance vector is ";
     
    549549      third  = mol->AskAtom("Enter last atom: ");
    550550      tmp1 = tmp2 = tmp3 = 0.;
    551       x.CopyVector((const vector *)&first->x);
    552       x.SubtractVector((const vector *)&second->x);
    553       y.CopyVector((const vector *)&third->x);
    554       y.SubtractVector((const vector *)&second->x);
     551      x.CopyVector((const Vector *)&first->x);
     552      x.SubtractVector((const Vector *)&second->x);
     553      y.CopyVector((const Vector *)&third->x);
     554      y.SubtractVector((const Vector *)&second->x);
    555555      cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    556       cout << Verbose(0) << (acos(x.ScalarProduct((const vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;         
     556      cout << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;         
    557557      break;
    558558    case 'd':
     
    727727static int ParseCommandLineOptions(int argc, char **argv, molecule *&mol, periodentafel *&periode, config& configuration, char *&ConfigFileName, char *&PathToDatabases)
    728728{
    729   vector x,y,z,n;  // coordinates for absolute point in cell volume
     729  Vector x,y,z,n;  // coordinates for absolute point in cell volume
    730730  double *factor; // unit factor if desired
    731731  ifstream test;
     
    889889              for (int i=NDIM;i--;)
    890890                x.x[i] = atof(argv[argptr+i]);
    891               mol->Translate((const vector *)&x);
     891              mol->Translate((const Vector *)&x);
    892892              argptr+=3;
    893893              break;
     
    958958                mol->cell_size[j] += x.x[i]*2.;
    959959              }
    960               mol->Translate((const vector *)&x);
     960              mol->Translate((const Vector *)&x);
    961961              break;
    962962            case 'O':
     
    10341034                int count;
    10351035                element ** Elements;
    1036                 vector ** vectors;
     1036                Vector ** vectors;
    10371037                if (faktor < 1) {
    10381038                  cerr << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;
     
    10431043                  count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
    10441044                  Elements = new element *[count];
    1045                   vectors = new vector *[count];
     1045                  vectors = new Vector *[count];
    10461046                  j = 0;
    10471047                  first = mol->start;
     
    11171117  atom *first, *second;
    11181118  char choice;  // menu choice char
    1119   vector x,y,z,n;  // coordinates for absolute point in cell volume
     1119  Vector x,y,z,n;  // coordinates for absolute point in cell volume
    11201120        double *factor; // unit factor if desired
    11211121  bool valid; // flag if input was valid or not
     
    11321132  clock_t start,end;
    11331133  element **Elements;
    1134   vector **vectors;
     1134  Vector **vectors;
    11351135
    11361136  // =========================== PARSE COMMAND LINE OPTIONS ====================================
     
    12311231          count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
    12321232          Elements = new element *[count];
    1233           vectors = new vector *[count];
     1233          vectors = new Vector *[count];
    12341234          j = 0;
    12351235          first = mol->start;
     
    13351335       cout << Verbose(0) << "Enter translation vector." << endl;       
    13361336       x.AskPosition(mol->cell_size,0);
    1337        mol->Translate((const vector *)&x);
     1337       mol->Translate((const Vector *)&x);
    13381338       break;
    13391339 
  • src/moleculelist.cpp

    rd7e30c re9b8bb  
    388388  bool intermediateResult = true;
    389389  atom *Walker = NULL;
    390   vector BoxDimension;
     390  Vector BoxDimension;
    391391  char *FragmentNumber = NULL;
    392392  char *path = NULL;
  • src/molecules.cpp

    rd7e30c re9b8bb  
    1818  double sum = 0.;
    1919  struct LSQ_params *par = (struct LSQ_params *)params;
    20   vector **vectors = par->vectors;
     20  Vector **vectors = par->vectors;
    2121  int num = par->num;
    2222
     
    180180  atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added
    181181  double b,l,d,f,g, alpha, factors[NDIM];    // hold temporary values in triple bond case for coordination determination
    182   vector Orthovector1, Orthovector2;  // temporary vectors in coordination construction
    183   vector InBondvector;    // vector in direction of *Bond
     182  Vector Orthovector1, Orthovector2;  // temporary vectors in coordination construction
     183  Vector InBondvector;    // vector in direction of *Bond
    184184  bond *Binder = NULL;
    185185  double *matrix;
     
    587587 * \param *dim vector class
    588588 */
    589 void molecule::SetBoxDimension(vector *dim)
     589void molecule::SetBoxDimension(Vector *dim)
    590590{
    591591  cell_size[0] = dim->x[0];
     
    601601 * \param *BoxLengths box lengths
    602602 */
    603 bool molecule::CenterInBox(ofstream *out, vector *BoxLengths)
     603bool molecule::CenterInBox(ofstream *out, Vector *BoxLengths)
    604604{
    605605  bool status = true;
    606606  atom *ptr = NULL;
    607   vector *min = new vector;
    608   vector *max = new vector;
     607  Vector *min = new Vector;
     608  Vector *max = new Vector;
    609609 
    610610  // gather min and max for each axis
     
    651651 * \param *max coordinates of other edge, specifying box dimensions.
    652652 */
    653 void molecule::CenterEdge(ofstream *out, vector *max)
    654 {
    655   vector *min = new vector;
     653void molecule::CenterEdge(ofstream *out, Vector *max)
     654{
     655  Vector *min = new Vector;
    656656 
    657657//  *out << Verbose(3) << "Begin of CenterEdge." << endl;
     
    690690 * \param *center return vector for translation vector
    691691 */
    692 void molecule::CenterOrigin(ofstream *out, vector *center)
     692void molecule::CenterOrigin(ofstream *out, Vector *center)
    693693{
    694694  int Num = 0;
     
    713713 * \return pointer to center of gravity vector
    714714 */
    715 vector * molecule::DetermineCenterOfGravity(ofstream *out)
     715Vector * molecule::DetermineCenterOfGravity(ofstream *out)
    716716{
    717717        atom *ptr = start->next;  // start at first in list
    718         vector *a = new vector();
    719         vector tmp;
     718        Vector *a = new Vector();
     719        Vector tmp;
    720720  double Num = 0;
    721721       
     
    742742 * \param *center return vector for translation vector
    743743 */
    744 void molecule::CenterGravity(ofstream *out, vector *center)
     744void molecule::CenterGravity(ofstream *out, Vector *center)
    745745{
    746746  if (center == NULL) {
     
    769769 * \param trans[] translation vector.
    770770 */
    771 void molecule::Translate(const vector *trans)
     771void molecule::Translate(const Vector *trans)
    772772{
    773773  atom *ptr = start;
     
    782782 * \param n[] normal vector of mirror plane.
    783783 */
    784 void molecule::Mirror(const vector *n)
     784void molecule::Mirror(const Vector *n)
    785785{
    786786  atom *ptr = start;
     
    795795 * \param Center reference to return vector
    796796 */
    797 void molecule::DetermineCenter(vector &Center)
     797void molecule::DetermineCenter(Vector &Center)
    798798{
    799799  atom *Walker = start;
     
    802802  double tmp;
    803803  bool flag;
    804   vector Testvector, Translationvector;
     804  Vector Testvector, Translationvector;
    805805 
    806806  do {
     
    867867        atom *ptr = start;  // start at first in list
    868868        double InertiaTensor[NDIM*NDIM];
    869         vector *CenterOfGravity = DetermineCenterOfGravity(out);
     869        Vector *CenterOfGravity = DetermineCenterOfGravity(out);
    870870
    871871        CenterGravity(out, CenterOfGravity);
     
    878878        while (ptr->next != end) {
    879879                ptr = ptr->next;
    880                 vector x;
     880                Vector x;
    881881                x.CopyVector(&ptr->x);
    882882                //x.SubtractVector(CenterOfGravity);
     
    934934    while (ptr->next != end) {
    935935      ptr = ptr->next;
    936       vector x;
     936      Vector x;
    937937      x.CopyVector(&ptr->x);
    938938      //x.SubtractVector(CenterOfGravity);
     
    10601060 * \param n[] alignment vector.
    10611061 */
    1062 void molecule::Align(vector *n)
     1062void molecule::Align(Vector *n)
    10631063{
    10641064  atom *ptr = start;
    10651065  double alpha, tmp;
    1066   vector z_axis;
     1066  Vector z_axis;
    10671067  z_axis.x[0] = 0.;
    10681068  z_axis.x[1] = 0.;
     
    11681168 * \return true - is within, false - out of cell
    11691169 */
    1170 bool molecule::CheckBounds(const vector *x) const
     1170bool molecule::CheckBounds(const Vector *x) const
    11711171{
    11721172  bool result = true;
     
    11881188{
    11891189  double res = 0, t;
    1190   vector a,b,c,d;
     1190  Vector a,b,c,d;
    11911191  struct lsq_params *par = (struct lsq_params *)params;
    11921192  atom *ptr = par->mol->start;
     
    12091209      d.Scale(&t);
    12101210      c.SubtractVector(&d);   // ... yielding distance vector
    1211       res += d.ScalarProduct((const vector *)&d);        // add squared distance
     1211      res += d.ScalarProduct((const Vector *)&d);        // add squared distance
    12121212    }
    12131213  }
     
    15421542  double distance, MinDistance, MaxDistance;
    15431543  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    1544   vector x;
     1544  Vector x;
    15451545 
    15461546  BondDistance = bonddistance; // * ((IsAngstroem) ? 1. : 1./AtomicLengthToAngstroem);
     
    39253925  enum Shading *ColorList = NULL;
    39263926  double tmp;
    3927   vector Translationvector;
     3927  Vector Translationvector;
    39283928  //class StackClass<atom *> *CompStack = NULL;
    39293929  class StackClass<atom *> *AtomStack = new StackClass<atom *>(AtomCount);
     
    43264326  int flag;
    43274327  double *Distances = NULL, *OtherDistances = NULL;
    4328   vector CenterOfGravity, OtherCenterOfGravity;
     4328  Vector CenterOfGravity, OtherCenterOfGravity;
    43294329  size_t *PermMap = NULL, *OtherPermMap = NULL;
    43304330  int *PermutationMap = NULL;
  • src/molecules.hpp

    rd7e30c re9b8bb  
    7373 */
    7474struct LSQ_params {
    75   vector **vectors;
     75  Vector **vectors;
    7676  int num;
    7777};
     
    9494class atom {
    9595  public:
    96     vector x;       //!< coordinate array of atom, giving position within cell
    97     vector v;       //!< velocity array of atom
     96    Vector x;       //!< coordinate array of atom, giving position within cell
     97    Vector v;       //!< velocity array of atom
    9898    element *type;  //!< pointing to element
    9999    atom *previous; //!< previous atom in molecule list
     
    212212  void CountElements();
    213213  void CalculateOrbitals(class config &configuration);
    214   bool CenterInBox(ofstream *out, vector *BoxLengths);
    215   void CenterEdge(ofstream *out, vector *max);
    216   void CenterOrigin(ofstream *out, vector *max);
    217   void CenterGravity(ofstream *out, vector *max);
    218   void Translate(const vector *x);
    219   void Mirror(const vector *x);
    220   void Align(vector *n);
     214  bool CenterInBox(ofstream *out, Vector *BoxLengths);
     215  void CenterEdge(ofstream *out, Vector *max);
     216  void CenterOrigin(ofstream *out, Vector *max);
     217  void CenterGravity(ofstream *out, Vector *max);
     218  void Translate(const Vector *x);
     219  void Mirror(const Vector *x);
     220  void Align(Vector *n);
    221221  void Scale(double **factor);
    222   void DetermineCenter(vector &center);
    223   vector * DetermineCenterOfGravity(ofstream *out);
    224   void SetBoxDimension(vector *dim);
     222  void DetermineCenter(Vector &center);
     223  Vector * DetermineCenterOfGravity(ofstream *out);
     224  void SetBoxDimension(Vector *dim);
    225225  double * ReturnFullMatrixforSymmetric(double *cell_size);
    226226  void ScanForPeriodicCorrection(ofstream *out);
     
    229229        bool VerletForceIntegration(char *file, double delta_t);
    230230       
    231   bool CheckBounds(const vector *x) const;
     231  bool CheckBounds(const Vector *x) const;
    232232  void GetAlignvector(struct lsq_params * par) const;
    233233
  • src/vector.cpp

    rd7e30c re9b8bb  
    1212/** Constructor of class vector.
    1313 */
    14 vector::vector() { x[0] = x[1] = x[2] = 0.; };
     14Vector::Vector() { x[0] = x[1] = x[2] = 0.; };
    1515
    1616/** Constructor of class vector.
    1717 */
    18 vector::vector(double x1, double x2, double x3) { x[0] = x1; x[1] = x2; x[2] = x3; };
     18Vector::Vector(double x1, double x2, double x3) { x[0] = x1; x[1] = x2; x[2] = x3; };
    1919
    2020/** Desctructor of class vector.
    2121 */
    22 vector::~vector() {};
     22Vector::~Vector() {};
    2323
    2424/** Calculates distance between this and another vector.
     
    2626 * \return \f$| x - y |^2\f$
    2727 */
    28 double vector::Distance(const vector *y) const
     28double Vector::Distance(const Vector *y) const
    2929{
    3030  double res = 0.;
     
    3939 * \return \f$| x - y |^2\f$
    4040 */
    41 double vector::PeriodicDistance(const vector *y, const double *cell_size) const
     41double Vector::PeriodicDistance(const Vector *y, const double *cell_size) const
    4242{
    4343  double res = Distance(y), tmp, matrix[NDIM*NDIM];
    44   vector Shiftedy, TranslationVector;
     44  Vector Shiftedy, TranslationVector;
    4545  int N[NDIM];
    4646  matrix[0] = cell_size[0];
     
    7676 * Tries to translate a vector into each adjacent neighbouring cell.
    7777 */
    78 void vector::KeepPeriodic(ofstream *out, double *matrix)
     78void Vector::KeepPeriodic(ofstream *out, double *matrix)
    7979{
    8080//  int N[NDIM];
    8181//  bool flag = false;
    8282  //vector Shifted, TranslationVector;
    83   vector TestVector;
     83  Vector TestVector;
    8484//  *out << Verbose(1) << "Begin of KeepPeriodic." << endl;
    8585//  *out << Verbose(2) << "Vector is: ";
     
    107107 * \return \f$\langle x, y \rangle\f$
    108108 */
    109 double vector::ScalarProduct(const vector *y) const
     109double Vector::ScalarProduct(const Vector *y) const
    110110{
    111111  double res = 0.;
     
    119119 * \return \f$\langle x, y \rangle\f$
    120120 */
    121 void vector::ProjectOntoPlane(const vector *y)
    122 {
    123   vector tmp;
     121void Vector::ProjectOntoPlane(const Vector *y)
     122{
     123  Vector tmp;
    124124  tmp.CopyVector(y);
    125125  tmp.Scale(Projection(y));
     
    131131 * \return \f$\langle x, y \rangle\f$
    132132 */
    133 double vector::Projection(const vector *y) const
     133double Vector::Projection(const Vector *y) const
    134134{
    135135  return (ScalarProduct(y));
     
    139139 * \return \f$|x|\f$
    140140 */
    141 double vector::Norm() const
     141double Vector::Norm() const
    142142{
    143143  double res = 0.;
     
    149149/** Normalizes this vector.
    150150 */
    151 void vector::Normalize()
     151void Vector::Normalize()
    152152{
    153153  double res = 0.;
     
    160160/** Zeros all components of this vector.
    161161 */
    162 void vector::Zero()
     162void Vector::Zero()
    163163{
    164164  for (int i=NDIM;i--;)
     
    168168/** Zeros all components of this vector.
    169169 */
    170 void vector::One(double one)
     170void Vector::One(double one)
    171171{
    172172  for (int i=NDIM;i--;)
     
    176176/** Initialises all components of this vector.
    177177 */
    178 void vector::Init(double x1, double x2, double x3)
     178void Vector::Init(double x1, double x2, double x3)
    179179{
    180180  x[0] = x1;
     
    187187 * \return \f$\acos\bigl(frac{\langle x, y \rangle}{|x||y|}\bigr)\f$
    188188 */
    189 double vector::Angle(vector *y) const
     189double Vector::Angle(Vector *y) const
    190190{
    191191  return acos(this->ScalarProduct(y)/Norm()/y->Norm());
     
    196196 * \param alpha rotation angle in radian
    197197 */
    198 void vector::RotateVector(const vector *axis, const double alpha)
    199 {
    200   vector a,y;
     198void Vector::RotateVector(const Vector *axis, const double alpha)
     199{
     200  Vector a,y;
    201201  // normalise this vector with respect to axis
    202202  a.CopyVector(this);
     
    220220 * \return lhs + a
    221221 */
    222 vector& operator+=(vector& a, const vector& b)
     222Vector& operator+=(Vector& a, const Vector& b)
    223223{
    224224  a.AddVector(&b);
     
    230230 * \return lhs.x[i] * m
    231231 */
    232 vector& operator*=(vector& a, const double m)
     232Vector& operator*=(Vector& a, const double m)
    233233{
    234234  a.Scale(m);
     
    241241 * \return a + b
    242242 */
    243 vector& operator+(const vector& a, const vector& b)
    244 {
    245   vector *x = new vector;
     243Vector& operator+(const Vector& a, const Vector& b)
     244{
     245  Vector *x = new Vector;
    246246  x->CopyVector(&a);
    247247  x->AddVector(&b);
     
    254254 * \return a + b
    255255 */
    256 vector& operator*(const vector& a, const double m)
    257 {
    258   vector *x = new vector;
     256Vector& operator*(const Vector& a, const double m)
     257{
     258  Vector *x = new Vector;
    259259  x->CopyVector(&a);
    260260  x->Scale(m);
     
    266266 * \param *out output stream
    267267 */
    268 bool vector::Output(ofstream *out) const
     268bool Vector::Output(ofstream *out) const
    269269{
    270270  if (out != NULL) {
     
    281281};
    282282
    283 ofstream& operator<<(ofstream& ost,vector& m)
     283ofstream& operator<<(ofstream& ost,Vector& m)
    284284{
    285285        m.Output(&ost);
     
    290290 * \param *factor pointer to scaling factor
    291291 */
    292 void vector::Scale(double **factor)
     292void Vector::Scale(double **factor)
    293293{
    294294  for (int i=NDIM;i--;)
     
    296296};
    297297
    298 void vector::Scale(double *factor)
     298void Vector::Scale(double *factor)
    299299{
    300300  for (int i=NDIM;i--;)
     
    302302};
    303303
    304 void vector::Scale(double factor)
     304void Vector::Scale(double factor)
    305305{
    306306  for (int i=NDIM;i--;)
     
    311311 * \param trans[] translation vector.
    312312 */
    313 void vector::Translate(const vector *trans)
     313void Vector::Translate(const Vector *trans)
    314314{
    315315  for (int i=NDIM;i--;)
     
    320320 * \param *matrix NDIM_NDIM array
    321321 */
    322 void vector::MatrixMultiplication(double *M)
    323 {
    324   vector C;
     322void Vector::MatrixMultiplication(double *M)
     323{
     324  Vector C;
    325325  // do the matrix multiplication
    326326  C.x[0] = M[0]*x[0]+M[3]*x[1]+M[6]*x[2];
     
    335335 * \param *matrix NDIM_NDIM array
    336336 */
    337 void vector::InverseMatrixMultiplication(double *A)
    338 {
    339   vector C;
     337void Vector::InverseMatrixMultiplication(double *A)
     338{
     339  Vector C;
    340340  double B[NDIM*NDIM];
    341341  double detA = RDET3(A);
     
    375375 * \param *factors three-component vector with the factor for each given vector
    376376 */
    377 void vector::LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors)
     377void Vector::LinearCombinationOfVectors(const Vector *x1, const Vector *x2, const Vector *x3, double *factors)
    378378{
    379379  for(int i=NDIM;i--;)
     
    384384 * \param n[] normal vector of mirror plane.
    385385 */
    386 void vector::Mirror(const vector *n)
     386void Vector::Mirror(const Vector *n)
    387387{
    388388  double projection;
     
    406406 * \return true - success, vectors are linear independent, false - failure due to linear dependency
    407407 */
    408 bool vector::MakeNormalVector(const vector *y1, const vector *y2, const vector *y3)
    409 {
    410   vector x1, x2;
     408bool Vector::MakeNormalVector(const Vector *y1, const Vector *y2, const Vector *y3)
     409{
     410  Vector x1, x2;
    411411
    412412  x1.CopyVector(y1);
     
    442442 * \return true - success, vectors are linear independent, false - failure due to linear dependency
    443443 */
    444 bool vector::MakeNormalVector(const vector *y1, const vector *y2)
    445 {
    446   vector x1,x2;
     444bool Vector::MakeNormalVector(const Vector *y1, const Vector *y2)
     445{
     446  Vector x1,x2;
    447447  x1.CopyVector(y1);
    448448  x2.CopyVector(y2);
     
    472472 * \return true - success, false - vector is zero
    473473 */
    474 bool vector::MakeNormalVector(const vector *y1)
     474bool Vector::MakeNormalVector(const Vector *y1)
    475475{
    476476        bool result = false;
    477   vector x1;
     477  Vector x1;
    478478  x1.CopyVector(y1);
    479479  x1.Scale(x1.Projection(this));
     
    491491 * \return true - success, false - failure (null vector given)
    492492 */
    493 bool vector::GetOneNormalVector(const vector *GivenVector)
     493bool Vector::GetOneNormalVector(const Vector *GivenVector)
    494494{
    495495  int Components[NDIM]; // contains indices of non-zero components
     
    537537 * \return scaling parameter for this vector
    538538 */
    539 double vector::CutsPlaneAt(vector *A, vector *B, vector *C)
     539double Vector::CutsPlaneAt(Vector *A, Vector *B, Vector *C)
    540540{
    541541//  cout << Verbose(3) << "For comparison: ";
     
    552552 * \return true if success, false if failed due to linear dependency
    553553 */
    554 bool vector::LSQdistance(vector **vectors, int num)
     554bool Vector::LSQdistance(Vector **vectors, int num)
    555555{
    556556        int j;
     
    634634 * \param *y vector
    635635 */
    636 void vector::AddVector(const vector *y)
     636void Vector::AddVector(const Vector *y)
    637637{
    638638  for (int i=NDIM;i--;)
     
    643643 * \param *y vector
    644644 */
    645 void vector::SubtractVector(const vector *y)
     645void Vector::SubtractVector(const Vector *y)
    646646{
    647647  for (int i=NDIM;i--;)
     
    652652 * \param *y vector
    653653 */
    654 void vector::CopyVector(const vector *y)
     654void Vector::CopyVector(const Vector *y)
    655655{
    656656  for (int i=NDIM;i--;)
     
    663663 * \param check whether bounds shall be checked (true) or not (false)
    664664 */
    665 void vector::AskPosition(double *cell_size, bool check)
     665void Vector::AskPosition(double *cell_size, bool check)
    666666{
    667667  char coords[3] = {'x','y','z'};
     
    691691 * \bug this is not yet working properly
    692692 */
    693 bool vector::SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c)
     693bool Vector::SolveSystem(Vector *x1, Vector *x2, Vector *y, double alpha, double beta, double c)
    694694{
    695695  double D1,D2,D3,E1,E2,F1,F2,F3,p,q=0., A, B1, B2, C;
  • src/vector.hpp

    rd7e30c re9b8bb  
    22#define VECTOR_HPP_
    33
    4 class vector;
     4class Vector;
    55
    66/** Single vector.
    77 * basically, just a x[3] but with helpful functions
    88 */
    9 class vector {   
     9class Vector {   
    1010  public:
    1111    double x[NDIM];
    1212
    13   vector();
    14   vector(double x1, double x2, double x3);
    15   ~vector();
     13  Vector();
     14  Vector(double x1, double x2, double x3);
     15  ~Vector();
    1616
    17   double Distance(const vector *y) const;
    18   double PeriodicDistance(const vector *y, const double *cell_size) const;
    19   double ScalarProduct(const vector *y) const;
    20   double Projection(const vector *y) const;
     17  double Distance(const Vector *y) const;
     18  double PeriodicDistance(const Vector *y, const double *cell_size) const;
     19  double ScalarProduct(const Vector *y) const;
     20  double Projection(const Vector *y) const;
    2121  double Norm() const ;
    22   double Angle(vector *y) const;
     22  double Angle(Vector *y) const;
    2323
    24   void AddVector(const vector *y);
    25   void SubtractVector(const vector *y);
    26   void CopyVector(const vector *y);
    27   void RotateVector(const vector *y, const double alpha);
    28   void ProjectOntoPlane(const vector *y);
     24  void AddVector(const Vector *y);
     25  void SubtractVector(const Vector *y);
     26  void CopyVector(const Vector *y);
     27  void RotateVector(const Vector *y, const double alpha);
     28  void ProjectOntoPlane(const Vector *y);
    2929  void Zero();
    3030  void One(double one);
    3131  void Init(double x1, double x2, double x3);
    3232  void Normalize();
    33   void Translate(const vector *x);
    34   void Mirror(const vector *x);
     33  void Translate(const Vector *x);
     34  void Mirror(const Vector *x);
    3535  void Scale(double **factor);
    3636  void Scale(double *factor);
     
    3939  void InverseMatrixMultiplication(double *M);
    4040  void KeepPeriodic(ofstream *out, double *matrix);
    41   void LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors);
     41  void LinearCombinationOfVectors(const Vector *x1, const Vector *x2, const Vector *x3, double *factors);
    4242 
    43   double CutsPlaneAt(vector *A, vector *B, vector *C);
    44   bool GetOneNormalVector(const vector *x1);
    45   bool MakeNormalVector(const vector *y1);
    46   bool MakeNormalVector(const vector *y1, const vector *y2);
    47   bool MakeNormalVector(const vector *x1, const vector *x2, const vector *x3);
    48   bool SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c);
    49   bool LSQdistance(vector **vectors, int dim);
     43  double CutsPlaneAt(Vector *A, Vector *B, Vector *C);
     44  bool GetOneNormalVector(const Vector *x1);
     45  bool MakeNormalVector(const Vector *y1);
     46  bool MakeNormalVector(const Vector *y1, const Vector *y2);
     47  bool MakeNormalVector(const Vector *x1, const Vector *x2, const Vector *x3);
     48  bool SolveSystem(Vector *x1, Vector *x2, Vector *y, double alpha, double beta, double c);
     49  bool LSQdistance(Vector **vectors, int dim);
    5050
    5151  void AskPosition(double *cell_size, bool check);
     
    5353};
    5454
    55 ofstream& operator<<(ofstream& ost, vector& m);
    56 vector& operator+=(vector& a, const vector& b);
    57 vector& operator*=(vector& a, const double m);
    58 vector& operator*(const vector& a, const double m);
    59 vector& operator+(const vector& a, const vector& b);
     55ofstream& operator<<(ofstream& ost, Vector& m);
     56Vector& operator+=(Vector& a, const Vector& b);
     57Vector& operator*=(Vector& a, const double m);
     58Vector& operator*(const Vector& a, const double m);
     59Vector& operator+(const Vector& a, const Vector& b);
    6060
    6161#endif /*VECTOR_HPP_*/
Note: See TracChangeset for help on using the changeset viewer.