- Timestamp:
- Jul 2, 2010, 2:58:25 PM (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:
- c37386
- Parents:
- 986ed3
- git-author:
- Tillmann Crueger <crueger@…> (07/02/10 13:45:20)
- git-committer:
- Tillmann Crueger <crueger@…> (07/02/10 14:58:25)
- Location:
- src
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Matrix.cpp
r986ed3 rce3d2b 12 12 #include "Helpers/Assert.hpp" 13 13 #include "vector.hpp" 14 #include "VectorContent.hpp" 14 15 15 16 #include <gsl/gsl_blas.h> … … 196 197 Vector operator*(const Matrix &mat,const Vector &vec){ 197 198 gsl_vector *res = gsl_vector_calloc(NDIM); 198 gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content, 0.0, res); 199 return Vector(res); 199 gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content->content, 0.0, res); 200 VectorContent *content = new VectorContent(); 201 content->content = res; 202 return Vector(content); 200 203 } 201 204 -
src/gslvector.cpp
r986ed3 rce3d2b 14 14 #include "defs.hpp" 15 15 #include "vector.hpp" 16 #include "VectorContent.hpp" 16 17 17 18 /** Constructor of class GSLVector. … … 69 70 */ 70 71 void GSLVector::SetFromVector(Vector &v){ 71 gsl_vector_memcpy (vector, v.get() );72 gsl_vector_memcpy (vector, v.get()->content); 72 73 } 73 74 -
src/vector.cpp
r986ed3 rce3d2b 8 8 9 9 #include "vector.hpp" 10 #include "VectorContent.hpp" 10 11 #include "verbose.hpp" 11 12 #include "World.hpp" … … 27 28 Vector::Vector() 28 29 { 29 content = gsl_vector_calloc (NDIM); 30 content = new VectorContent(); 31 content->content = gsl_vector_calloc (NDIM); 30 32 }; 31 33 … … 36 38 Vector::Vector(const Vector& src) 37 39 { 38 content = gsl_vector_alloc(NDIM); 39 gsl_vector_memcpy(content, src.content); 40 content = new VectorContent(); 41 content->content = gsl_vector_alloc(NDIM); 42 gsl_vector_memcpy(content->content, src.content->content); 40 43 } 41 44 … … 44 47 Vector::Vector(const double x1, const double x2, const double x3) 45 48 { 46 content = gsl_vector_alloc(NDIM); 47 gsl_vector_set(content,0,x1); 48 gsl_vector_set(content,1,x2); 49 gsl_vector_set(content,2,x3); 50 }; 51 52 Vector::Vector(gsl_vector *_content) : 49 content = new VectorContent(); 50 content->content = gsl_vector_alloc(NDIM); 51 gsl_vector_set(content->content,0,x1); 52 gsl_vector_set(content->content,1,x2); 53 gsl_vector_set(content->content,2,x3); 54 }; 55 56 Vector::Vector(VectorContent *_content) : 53 57 content(_content) 54 58 {} … … 60 64 // check for self assignment 61 65 if(&src!=this){ 62 gsl_vector_memcpy(content , src.content);66 gsl_vector_memcpy(content->content, src.content->content); 63 67 } 64 68 return *this; … … 68 72 */ 69 73 Vector::~Vector() { 70 gsl_vector_free(content); 74 gsl_vector_free(content->content); 75 delete content; 71 76 }; 72 77 … … 104 109 { 105 110 double res = 0.; 106 gsl_blas_ddot(content , y.content, &res);111 gsl_blas_ddot(content->content, y.content->content, &res); 107 112 return (res); 108 113 }; … … 269 274 double& Vector::operator[](size_t i){ 270 275 ASSERT(i<=NDIM && i>=0,"Vector Index out of Range"); 271 return *gsl_vector_ptr (content , i);276 return *gsl_vector_ptr (content->content, i); 272 277 } 273 278 274 279 const double& Vector::operator[](size_t i) const{ 275 280 ASSERT(i<=NDIM && i>=0,"Vector Index out of Range"); 276 return *gsl_vector_ptr (content , i);281 return *gsl_vector_ptr (content->content, i); 277 282 } 278 283 … … 285 290 } 286 291 287 gsl_vector* Vector::get(){292 VectorContent* Vector::get(){ 288 293 return content; 289 294 } … … 405 410 406 411 void Vector::ScaleAll(const Vector &factor){ 407 gsl_vector_mul(content , factor.content);412 gsl_vector_mul(content->content, factor.content->content); 408 413 } 409 414 … … 411 416 void Vector::Scale(const double factor) 412 417 { 413 gsl_vector_scale(content ,factor);418 gsl_vector_scale(content->content,factor); 414 419 }; 415 420 … … 519 524 void Vector::AddVector(const Vector &y) 520 525 { 521 gsl_vector_add(content , y.content);526 gsl_vector_add(content->content, y.content->content); 522 527 } 523 528 … … 527 532 void Vector::SubtractVector(const Vector &y) 528 533 { 529 gsl_vector_sub(content , y.content);534 gsl_vector_sub(content->content, y.content->content); 530 535 } 531 536 -
src/vector.hpp
r986ed3 rce3d2b 12 12 13 13 #include <iosfwd> 14 #include <gsl/gsl_vector.h>15 14 16 15 #include <memory> … … 24 23 class Vector; 25 24 class Matrix; 25 struct VectorContent; 26 26 27 27 typedef std::vector<Vector> pointset; … … 73 73 74 74 // Access to internal structure 75 gsl_vector* get();75 VectorContent* get(); 76 76 77 77 // Methods that are derived directly from other methods … … 98 98 99 99 private: 100 Vector( gsl_vector*);101 gsl_vector*content;100 Vector(VectorContent *); 101 VectorContent *content; 102 102 103 103 };
Note:
See TracChangeset
for help on using the changeset viewer.