Changeset e089fb for src/Jobs


Ignore:
Timestamp:
Feb 14, 2013, 12:26:12 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:
3d9a8d
Parents:
1b01e9
git-author:
Frederik Heber <heber@…> (12/03/12 12:43:00)
git-committer:
Frederik Heber <heber@…> (02/14/13 12:26:12)
Message:

Moved particle arrays into a new struct in VMGJob.

  • also the docu now states that we don't need to serialize it.
Location:
src/Jobs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Jobs/VMGJob.cpp

    r1b01e9 re089fb  
    9090  interpolation_degree(_interpolation_degree),
    9191  returndata(static_cast<const SamplingGridProperties &>(_density_grid)),
     92  particles()
     93{}
     94
     95VMGJob::VMGJob() :
     96  FragmentJob(JobId::IllegalJob),
     97  near_field_cells(3),
     98  interpolation_degree(3),
     99  particles()
     100{}
     101
     102VMGJob::~VMGJob()
     103{
     104}
     105
     106
     107VMGJob::particle_arrays::particle_arrays() :
    92108  num_particles(0),
    93109  f(NULL),
     
    97113{}
    98114
    99 VMGJob::VMGJob() :
    100   FragmentJob(JobId::IllegalJob),
    101   near_field_cells(3),
    102   interpolation_degree(3),
    103   num_particles(0),
    104   f(NULL),
    105   x(NULL),
    106   p(NULL),
    107   q(NULL)
    108 {}
    109 
    110 VMGJob::~VMGJob()
     115VMGJob::particle_arrays::~particle_arrays()
    111116{
    112117  delete[] f;
     
    116121}
    117122
    118 void VMGJob::InitVMGArrays()
    119 {
    120   num_particles = particle_charges.size();
     123void VMGJob::particle_arrays::init(const size_t _num_particles)
     124{
     125  num_particles = _num_particles;
    121126  f = new double[num_particles*3];
    122127  x = new double[num_particles*3];
    123128  p = new double[num_particles];
    124129  q = new double[num_particles];
     130}
     131
     132void VMGJob::InitVMGArrays()
     133{
     134  particles.init(particle_charges.size());
    125135
    126136  {
     
    130140      for (std::vector< double >::const_iterator positer = (*iter).begin();
    131141          positer != (*iter).end(); ++positer) {
    132         f[index] = 0.;
    133         x[index++] = *positer;
     142        particles.f[index] = 0.;
     143        particles.x[index++] = *positer;
    134144      }
    135145    }
    136     ASSERT( index == num_particles*3,
     146    ASSERT( index == particles.num_particles*3,
    137147        "VMGJob::VMGJob() - too many particles or components in particle_positions.");
    138148  }
     
    141151    for (std::vector< double >::const_iterator iter = particle_charges.begin();
    142152        iter != particle_charges.end(); ++iter) {
    143       p[index] = 0.;
    144       q[index++] = *iter;
     153      particles.p[index] = 0.;
     154      particles.q[index++] = *iter;
    145155    }
    146     ASSERT( index == num_particles,
     156    ASSERT( index == particles.num_particles,
    147157        "VMGJob::VMGJob() - too many charges in particle_charges.");
    148158  }
     
    226236  InitVMGArrays();
    227237  // then initialize as objects with VMG's storage
    228   new ObjectStorage<vmg_float*>("PARTICLE_POS_ARRAY", x);
    229   new ObjectStorage<vmg_float*>("PARTICLE_CHARGE_ARRAY", q);
    230   new ObjectStorage<vmg_float*>("PARTICLE_POTENTIAL_ARRAY", p);
    231   new ObjectStorage<vmg_float*>("PARTICLE_FIELD_ARRAY", f);
    232   new ObjectStorage<vmg_int>("PARTICLE_NUM_LOCAL", num_particles);
     238  new ObjectStorage<vmg_float*>("PARTICLE_POS_ARRAY", particles.x);
     239  new ObjectStorage<vmg_float*>("PARTICLE_CHARGE_ARRAY", particles.q);
     240  new ObjectStorage<vmg_float*>("PARTICLE_POTENTIAL_ARRAY", particles.p);
     241  new ObjectStorage<vmg_float*>("PARTICLE_FIELD_ARRAY", particles.f);
     242  new ObjectStorage<vmg_int>("PARTICLE_NUM_LOCAL", particles.num_particles);
    233243
    234244  /*
  • src/Jobs/VMGJob.hpp

    r1b01e9 re089fb  
    7575  VMGData returndata;
    7676
    77   //!> number of particles
    78   size_t num_particles;
    79   //!> forces array
    80   double *f;
    81   //!> position array
    82   double *x;
    83   //!> potential array
    84   double *p;
    85   //!> charge array
    86   double *q;
     77  /** This structure stores particle values per particle.
     78   *
     79   * \note This structure contains temporary information needed during solving
     80   * with VMG.
     81   * \warning It is specifically not serialized!
     82   *
     83   */
     84  struct particle_arrays {
     85    particle_arrays();
     86    ~particle_arrays();
     87
     88    /** Initializes arrays.
     89     *
     90     * @param _num_particles size of array per dimension
     91     */
     92    void init(const size_t _num_particles);
     93
     94    //!> number of particles
     95    size_t num_particles;
     96    //!> forces array
     97    double *f;
     98    //!> position array
     99    double *x;
     100    //!> potential array
     101    double *p;
     102    //!> charge array
     103    double *q;
     104  } particles;
    87105
    88106private:
Note: See TracChangeset for help on using the changeset viewer.