Changeset 776b64 for src/builder.cpp


Ignore:
Timestamp:
Oct 27, 2009, 4:11:22 PM (15 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:
fb73b8
Parents:
ad37ab
Message:

Huge refactoring to make const what is const (ticket #38), continued.

  • too many changes because of too many cross-references to be able to list them up here.
  • NOTE that "make check" runs fine and did catch several error.
  • note that we had to use const_iterator several times when the map, ... was declared const.
  • at times we changed an allocated LinkedCell LCList(...) into

const LinkedCell *LCList;
LCList = new LinkedCell(...);

  • also mutable (see ticket #5) was used, e.g. for molecule::InternalPointer (PointCloud changes are allowed, because they are just accounting).

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    rad37ab r776b64  
    254254        } while ((j != -1) && (i<128));
    255255        if (i >= 2) {
    256           first->x.LSQdistance(atoms, i);
     256          first->x.LSQdistance((const Vector **)atoms, i);
    257257
    258258          first->x.Output((ofstream *)&cout);
     
    592592      {
    593593        cout << Verbose(0) << "Evaluating volume of the convex envelope.";
    594         LinkedCell LCList(mol, 10.);
    595594        class Tesselation *TesselStruct = NULL;
    596         FindConvexBorder((ofstream *)&cout, mol, &LCList, NULL);
     595        const LinkedCell *LCList = NULL;
     596        LCList = new LinkedCell(mol, 10.);
     597        FindConvexBorder((ofstream *)&cout, mol, TesselStruct, LCList, NULL);
    597598        double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, TesselStruct, configuration);
    598         cout << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;
     599        cout << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
     600        delete(LCList);
    599601        delete(TesselStruct);
    600602      }
     
    720722       cin >> factor[2];
    721723       valid = true;
    722        mol->Scale(&factor);
     724       mol->Scale((const double ** const)&factor);
    723725       delete[](factor);
    724726      }
     
    15881590                // get the boundary
    15891591                class molecule *Boundary = new molecule(periode);
     1592                class Tesselation *TesselStruct = NULL;
    15901593                struct ConfigFileBuffer *FileBuffer = NULL;
    15911594                PrepareFileBuffer(argv[argptr], FileBuffer);
    15921595                LoadMolecule(Boundary, FileBuffer, periode, false);
    1593                 LinkedCell LCList(Boundary, 2.*radius);
     1596                const LinkedCell *LCList = NULL;
     1597                LCList = new LinkedCell(Boundary, 2.*radius);
    15941598                element *oxygen = periode->FindElement(8);
    1595                 FindNonConvexBorder((ofstream *)&cout, Boundary, &LCList, radius, NULL);
    1596 
    1597                 CorrelationToSurfaceMap *surfacemap = CorrelationToSurface( (ofstream *)&cout, mol, oxygen, Boundary->TesselStruct, &LCList );
     1599                FindNonConvexBorder((ofstream *)&cout, Boundary, TesselStruct, LCList, radius, NULL);
     1600                CorrelationToSurfaceMap *surfacemap = CorrelationToSurface( (ofstream *)&cout, mol, oxygen, TesselStruct, LCList );
    15981601                BinPairMap *binmap = BinData( (ofstream *)&cout, surfacemap, 0.5, 0., 0. );
    15991602                OutputCorrelation ( &binoutput, binmap );
    16001603                output.close();
    16011604                binoutput.close();
     1605                delete(LCList);
    16021606                delete(FileBuffer);
     1607                delete(TesselStruct);
    16031608                delete(Boundary);
    16041609                argptr+=3;
     
    16751680                cerr << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
    16761681              } else {
    1677                 class Tesselation T;
     1682                class Tesselation *T = NULL;
     1683                const LinkedCell *LCList = NULL;
    16781684                string filename(argv[argptr+1]);
    16791685                filename.append(".csv");
     
    16811687                cout << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
    16821688                start = clock();
    1683                 LinkedCell LCList(mol, atof(argv[argptr])*2.);
    1684                 FindNonConvexBorder((ofstream *)&cout, mol, &LCList, atof(argv[argptr]), argv[argptr+1]);
    1685                 //FindDistributionOfEllipsoids((ofstream *)&cout, &T, &LCList, N, number, filename.c_str());
     1689                LCList = new LinkedCell(mol, atof(argv[argptr])*2.);
     1690                FindNonConvexBorder((ofstream *)&cout, mol, T, LCList, atof(argv[argptr]), argv[argptr+1]);
     1691                //FindDistributionOfEllipsoids((ofstream *)&cout, T, &LCList, N, number, filename.c_str());
    16861692                end = clock();
    16871693                cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     1694                delete(LCList);
    16881695                argptr+=2;
    16891696              }
     
    18061813                factor[1] = atof(argv[argptr+1]);
    18071814                factor[2] = atof(argv[argptr+2]);
    1808                 mol->Scale(&factor);
     1815                mol->Scale((const double ** const)&factor);
    18091816                for (int i=0;i<NDIM;i++) {
    18101817                  j += i+1;
     
    19351942                cerr << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
    19361943              } else {
     1944                class Tesselation *TesselStruct = NULL;
     1945                const LinkedCell *LCList = NULL;
    19371946                cout << Verbose(0) << "Evaluating volume of the convex envelope.";
    19381947                cout << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
    19391948                cout << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;
    1940                 LinkedCell LCList(mol, 10.);
    1941                 //FindConvexBorder((ofstream *)&cout, mol, &LCList, argv[argptr]);
    1942                 FindNonConvexBorder((ofstream *)&cout, mol, &LCList, 5., argv[argptr+1]);
    1943 //                RemoveAllBoundaryPoints((ofstream *)&cout, mol->TesselStruct, mol, argv[argptr]);
    1944                 double volumedifference = ConvexizeNonconvexEnvelope((ofstream *)&cout, mol->TesselStruct, mol, argv[argptr]);
    1945                 double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, mol->TesselStruct, &configuration);
     1949                LCList = new LinkedCell(mol, 10.);
     1950                //FindConvexBorder((ofstream *)&cout, mol, LCList, argv[argptr]);
     1951                FindNonConvexBorder((ofstream *)&cout, mol, TesselStruct, LCList, 5., argv[argptr+1]);
     1952//                RemoveAllBoundaryPoints((ofstream *)&cout, TesselStruct, mol, argv[argptr]);
     1953                double volumedifference = ConvexizeNonconvexEnvelope((ofstream *)&cout, TesselStruct, mol, argv[argptr]);
     1954                double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, TesselStruct, &configuration);
    19461955                cout << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
    19471956                cout << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
     1957                delete(TesselStruct);
     1958                delete(LCList);
    19481959                argptr+=2;
    19491960              }
Note: See TracChangeset for help on using the changeset viewer.