Ignore:
Timestamp:
Apr 7, 2010, 3:45:38 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
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, Candidate_v1.7.0, 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:
72e7fa
Parents:
f9352d
Message:

Made data internal data-structure of vector class private

  • Replaced occurences of access to internals with operator
  • moved Vector-class into LinAlg-Module
  • Reworked Vector to allow clean modularization
  • Added Plane class to describe arbitrary planes in 3d space
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselationhelpers.cpp

    rf9352d r0a4f7f  
    1414#include "tesselationhelpers.hpp"
    1515#include "vector.hpp"
     16#include "vector_ops.hpp"
    1617#include "verbose.hpp"
    1718
     
    5354
    5455  for(int i=0;i<3;i++) {
    55     gsl_matrix_set(A, i, 0, a.x[i]);
    56     gsl_matrix_set(A, i, 1, b.x[i]);
    57     gsl_matrix_set(A, i, 2, c.x[i]);
     56    gsl_matrix_set(A, i, 0, a[i]);
     57    gsl_matrix_set(A, i, 1, b[i]);
     58    gsl_matrix_set(A, i, 2, c[i]);
    5859  }
    5960  m11 = DetGet(A, 1);
    6061
    6162  for(int i=0;i<3;i++) {
    62     gsl_matrix_set(A, i, 0, a.x[i]*a.x[i] + b.x[i]*b.x[i] + c.x[i]*c.x[i]);
    63     gsl_matrix_set(A, i, 1, b.x[i]);
    64     gsl_matrix_set(A, i, 2, c.x[i]);
     63    gsl_matrix_set(A, i, 0, a[i]*a[i] + b[i]*b[i] + c[i]*c[i]);
     64    gsl_matrix_set(A, i, 1, b[i]);
     65    gsl_matrix_set(A, i, 2, c[i]);
    6566  }
    6667  m12 = DetGet(A, 1);
    6768
    6869  for(int i=0;i<3;i++) {
    69     gsl_matrix_set(A, i, 0, a.x[i]*a.x[i] + b.x[i]*b.x[i] + c.x[i]*c.x[i]);
    70     gsl_matrix_set(A, i, 1, a.x[i]);
    71     gsl_matrix_set(A, i, 2, c.x[i]);
     70    gsl_matrix_set(A, i, 0, a[i]*a[i] + b[i]*b[i] + c[i]*c[i]);
     71    gsl_matrix_set(A, i, 1, a[i]);
     72    gsl_matrix_set(A, i, 2, c[i]);
    7273  }
    7374  m13 = DetGet(A, 1);
    7475
    7576  for(int i=0;i<3;i++) {
    76     gsl_matrix_set(A, i, 0, a.x[i]*a.x[i] + b.x[i]*b.x[i] + c.x[i]*c.x[i]);
    77     gsl_matrix_set(A, i, 1, a.x[i]);
    78     gsl_matrix_set(A, i, 2, b.x[i]);
     77    gsl_matrix_set(A, i, 0, a[i]*a[i] + b[i]*b[i] + c[i]*c[i]);
     78    gsl_matrix_set(A, i, 1, a[i]);
     79    gsl_matrix_set(A, i, 2, b[i]);
    7980  }
    8081  m14 = DetGet(A, 1);
     
    8384    eLog() << Verbose(1) << "three points are colinear." << endl;
    8485
    85   center->x[0] =  0.5 * m12/ m11;
    86   center->x[1] = -0.5 * m13/ m11;
    87   center->x[2] =  0.5 * m14/ m11;
     86  center->at(0) =  0.5 * m12/ m11;
     87  center->at(1) = -0.5 * m13/ m11;
     88  center->at(2) =  0.5 * m14/ m11;
    8889
    8990  if (fabs(a.Distance(center) - RADIUS) > MYEPSILON)
     
    281282  Vector SideA,SideB,HeightA, HeightB;
    282283  for (int i=0;i<NDIM;i++)
    283     intersection.x[i] = gsl_vector_get(x, i);
     284    intersection[i] = gsl_vector_get(x, i);
    284285
    285286  SideA.CopyVector(&(I->x1));
     
    336337    /* Starting point */
    337338    x = gsl_vector_alloc(NDIM);
    338     gsl_vector_set(x, 0, point1.x[0]);
    339     gsl_vector_set(x, 1, point1.x[1]);
    340     gsl_vector_set(x, 2, point1.x[2]);
     339    gsl_vector_set(x, 0, point1[0]);
     340    gsl_vector_set(x, 1, point1[1]);
     341    gsl_vector_set(x, 2, point1[2]);
    341342
    342343    /* Set initial step sizes to 1 */
     
    372373  double t1, t2;
    373374  for (int i = 0; i < NDIM; i++) {
    374     intersection.x[i] = gsl_vector_get(s->x, i);
     375    intersection[i] = gsl_vector_get(s->x, i);
    375376  }
    376377
     
    700701  // calculate the intersection between this projected baseline and Base
    701702  Vector *Intersection = new Vector;
    702   Intersection->GetIntersectionOfTwoLinesOnPlane(Base->endpoints[0]->node->node, Base->endpoints[1]->node->node, &NewOffset, &NewDirection, &Normal);
     703  *Intersection = GetIntersectionOfTwoLinesOnPlane(*(Base->endpoints[0]->node->node),
     704                                                   *(Base->endpoints[1]->node->node),
     705                                                     NewOffset, NewDirection);
    703706  Normal.CopyVector(Intersection);
    704707  Normal.SubtractVector(Base->endpoints[0]->node->node);
     
    747750      *vrmlfile << "Sphere {" << endl << "  "; // 2 is sphere type
    748751      for (i=0;i<NDIM;i++)
    749         *vrmlfile << Walker->node->x[i]-center->x[i] << " ";
     752        *vrmlfile << Walker->node->at(i)-center->at(i) << " ";
    750753      *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    751754      cloud->GoToNext();
     
    757760      for (i=0;i<3;i++) { // print each node
    758761        for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
    759           *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->x[j]-center->x[j] << " ";
     762          *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
    760763        *vrmlfile << "\t";
    761764      }
     
    792795    *rasterfile << "# current virtual sphere\n";
    793796    *rasterfile << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
    794     *rasterfile << "2\n  " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n";
     797    *rasterfile << "2\n  " << helper[0] << " " << helper[1] << " " << helper[2] << "\t" << 5. << "\t1 0 0\n";
    795798    *rasterfile << "9\n  terminating special property\n";
    796799    delete(center);
     
    820823      *rasterfile << "2" << endl << "  ";  // 2 is sphere type
    821824      for (i=0;i<NDIM;i++)
    822         *rasterfile << Walker->node->x[i]-center->x[i] << " ";
     825        *rasterfile << Walker->node->at(i)-center->at(i) << " ";
    823826      *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    824827      cloud->GoToNext();
     
    831834      for (i=0;i<3;i++) {  // print each node
    832835        for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
    833           *rasterfile << TriangleRunner->second->endpoints[i]->node->node->x[j]-center->x[j] << " ";
     836          *rasterfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
    834837        *rasterfile << "\t";
    835838      }
     
    877880      Walker = target->second->node;
    878881      LookupList[Walker->nr] = Counter++;
    879       *tecplot << Walker->node->x[0] << " " << Walker->node->x[1] << " " << Walker->node->x[2] << " " << target->second->value << endl;
     882      *tecplot << Walker->node->at(0) << " " << Walker->node->at(1) << " " << Walker->node->at(2) << " " << target->second->value << endl;
    880883    }
    881884    *tecplot << endl;
Note: See TracChangeset for help on using the changeset viewer.