Ignore:
Timestamp:
Mar 1, 2011, 10:16:38 AM (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, Candidate_v1.7.0, Candidate_v1.7.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:
caa06ef
Parents:
ba5215
git-author:
Frederik Heber <heber@…> (02/21/11 18:02:41)
git-committer:
Frederik Heber <heber@…> (03/01/11 10:16:38)
Message:

Bigger change: Replaced PointCloud by PointCloudAdaptor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselationhelpers.cpp

    rba5215 r34c43a  
    2828#include "CandidateForTesselation.hpp"
    2929#include "CodePatterns/Info.hpp"
     30#include "CodePatterns/Log.hpp"
     31#include "CodePatterns/Verbose.hpp"
     32#include "IPointCloud.hpp"
     33#include "LinearAlgebra/Line.hpp"
     34#include "LinearAlgebra/LinearSystemOfEquations.hpp"
     35#include "LinearAlgebra/Plane.hpp"
     36#include "LinearAlgebra/RealSpaceMatrix.hpp"
     37#include "LinearAlgebra/Vector.hpp"
     38#include "LinearAlgebra/vector_ops.hpp"
    3039#include "linkedcell.hpp"
    31 #include "LinearAlgebra/LinearSystemOfEquations.hpp"
    32 #include "CodePatterns/Log.hpp"
    3340#include "tesselation.hpp"
    3441#include "tesselationhelpers.hpp"
    35 #include "LinearAlgebra/Vector.hpp"
    36 #include "LinearAlgebra/Line.hpp"
    37 #include "LinearAlgebra/vector_ops.hpp"
    38 #include "CodePatterns/Verbose.hpp"
    39 #include "LinearAlgebra/Plane.hpp"
    40 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    4142
    4243void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS)
     
    427428    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    428429      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    429         const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
     430        const TesselPointSTLList *List = LC->GetCurrentCell();
    430431        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    431432        if (List != NULL) {
    432           for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     433          for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    433434            helper = (Point) - ((*Runner)->getPosition());
    434435            double currentNorm = helper. Norm();
     
    480481    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    481482      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    482         const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
     483        const TesselPointSTLList *List = LC->GetCurrentCell();
    483484        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    484485        if (List != NULL) {
    485           for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     486          for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    486487            helper = (Point) - ((*Runner)->getPosition());
    487488            double currentNorm = helper.NormSquared();
     
    569570 * \param *mol molecule structure with atom positions
    570571 */
    571 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud)
     572void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, IPointCloud & cloud)
    572573{
    573574        Info FunctionInfo(__func__);
    574575  TesselPoint *Walker = NULL;
    575576  int i;
    576   Vector *center = cloud->GetCenter();
     577  Vector *center = cloud.GetCenter();
    577578  if (vrmlfile != NULL) {
    578579    //Log() << Verbose(1) << "Writing Raster3D file ... ";
     
    580581    *vrmlfile << "#Created by molecuilder" << endl;
    581582    *vrmlfile << "#All atoms as spheres" << endl;
    582     cloud->GoToFirst();
    583     while (!cloud->IsEnd()) {
    584       Walker = cloud->GetPoint();
     583    cloud.GoToFirst();
     584    while (!cloud.IsEnd()) {
     585      Walker = cloud.GetPoint();
    585586      *vrmlfile << "Sphere {" << endl << "  "; // 2 is sphere type
    586587      for (i=0;i<NDIM;i++)
    587588        *vrmlfile << Walker->at(i)-center->at(i) << " ";
    588589      *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    589       cloud->GoToNext();
     590      cloud.GoToNext();
    590591    }
    591592
     
    613614 * \param *mol molecule structure with atom positions
    614615 */
    615 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
     616void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, IPointCloud & cloud)
    616617{
    617618        Info FunctionInfo(__func__);
     
    620621  if (Tess->LastTriangle != NULL) {
    621622    // include the current position of the virtual sphere in the temporary raster3d file
    622     Vector *center = cloud->GetCenter();
     623    Vector *center = cloud.GetCenter();
    623624    // make the circumsphere's center absolute again
    624625    Vector helper = (1./3.) * ((Tess->LastTriangle->endpoints[0]->node->getPosition()) +
     
    641642 * \param *mol molecule structure with atom positions
    642643 */
    643 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
     644void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, IPointCloud & cloud)
    644645{
    645646        Info FunctionInfo(__func__);
    646647  TesselPoint *Walker = NULL;
    647648  int i;
    648   Vector *center = cloud->GetCenter();
     649  Vector *center = cloud.GetCenter();
    649650  if (rasterfile != NULL) {
    650651    //Log() << Verbose(1) << "Writing Raster3D file ... ";
     
    652653    *rasterfile << "@header.r3d" << endl;
    653654    *rasterfile << "# All atoms as spheres" << endl;
    654     cloud->GoToFirst();
    655     while (!cloud->IsEnd()) {
    656       Walker = cloud->GetPoint();
     655    cloud.GoToFirst();
     656    while (!cloud.IsEnd()) {
     657      Walker = cloud.GetPoint();
    657658      *rasterfile << "2" << endl << "  ";  // 2 is sphere type
    658659      for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
     
    661662      }
    662663      *rasterfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    663       cloud->GoToNext();
     664      cloud.GoToNext();
    664665    }
    665666
     
    691692 * \param N arbitrary number to differentiate various zones in the tecplot format
    692693 */
    693 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N)
     694void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, IPointCloud & cloud, const int N)
    694695{
    695696        Info FunctionInfo(__func__);
     
    700701    *tecplot << "ZONE T=\"";
    701702    if (N < 0) {
    702       *tecplot << cloud->GetName();
     703      *tecplot << cloud.GetName();
    703704    } else {
    704705      *tecplot << N << "-";
     
    711712    }
    712713    *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
    713     const int MaxId=cloud->GetMaxId();
    714     int *LookupList = new int[MaxId];
    715     for (int i=0; i< MaxId ; i++){
     714    const int MaxId=cloud.GetMaxId();
     715    ASSERT(MaxId >= 0, "WriteTecplotFile() - negative MaxId? No atoms present?");
     716    int *LookupList = new int[MaxId+1];
     717    for (int i=0; i<= MaxId ; i++){
    716718      LookupList[i] = -1;
    717719    }
     
    722724    for (PointMap::const_iterator target = TesselStruct->PointsOnBoundary.begin(); target != TesselStruct->PointsOnBoundary.end(); ++target) {
    723725      Walker = target->second->node;
     726      ASSERT(Walker->nr <= MaxId, "WriteTecplotFile() - Id of particle greater than MaxId.");
    724727      LookupList[Walker->nr] = Counter++;
    725728      for (int i=0;i<NDIM;i++) {
Note: See TracChangeset for help on using the changeset viewer.