Changes in src/boundary.cpp [b998c3:d6eb80]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
rb998c3 rd6eb80 19 19 20 20 #include<gsl/gsl_poly.h> 21 #include<time.h> 21 22 22 23 // ========================================== F U N C T I O N S ================================= … … 654 655 * \param *out output stream for debugging 655 656 * \param *mol molecule with atoms and bonds 656 * \param * &TesselStruct Tesselation with boundary triangles657 * \param *TesselStruct Tesselation with boundary triangles 657 658 * \param *filename prefix of filename 658 659 * \param *extraSuffix intermediate suffix 659 660 */ 660 void StoreTrianglesinFile(const molecule * const mol, const Tesselation * &TesselStruct, const char *filename, const char *extraSuffix)661 void StoreTrianglesinFile(const molecule * const mol, const Tesselation * const TesselStruct, const char *filename, const char *extraSuffix) 661 662 { 662 663 Info FunctionInfo(__func__); … … 789 790 * \param configuration contains box dimensions 790 791 * \param distance[NDIM] distance between filling molecules in each direction 792 * \param boundary length of boundary zone between molecule and filling mollecules 793 * \param epsilon distance to surface which is not filled 791 794 * \param RandAtomDisplacement maximum distance for random displacement per atom 792 795 * \param RandMolDisplacement maximum distance for random displacement per filler molecule … … 794 797 * \return *mol pointer to new molecule with filled atoms 795 798 */ 796 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement,bool DoRandomRotation)799 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation) 797 800 { 798 801 Info FunctionInfo(__func__); … … 817 820 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { 818 821 Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl; 819 LCList[i] = new LinkedCell((*ListRunner), 5.); // get linked cell list 820 if (TesselStruct[i] == NULL) { 821 Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl; 822 FindNonConvexBorder((*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL); 823 } 822 LCList[i] = new LinkedCell((*ListRunner), 10.); // get linked cell list 823 Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl; 824 TesselStruct[i] = NULL; 825 FindNonConvexBorder((*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL); 824 826 i++; 825 827 } … … 835 837 FillerDistance.Init(distance[0], distance[1], distance[2]); 836 838 FillerDistance.InverseMatrixMultiplication(M); 837 Log() << Verbose(1) << "INFO: Grid steps are "; 838 for(int i=0;i<NDIM;i++) { 839 for(int i=0;i<NDIM;i++) 839 840 N[i] = (int) ceil(1./FillerDistance.x[i]); 840 Log() << Verbose(1) << N[i]; 841 if (i != NDIM-1) 842 Log() << Verbose(1)<< ", "; 843 else 844 Log() << Verbose(1) << "." << endl; 845 } 841 Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl; 842 843 // initialize seed of random number generator to current time 844 srand ( time(NULL) ); 846 845 847 846 // go over [0,1]^3 filler grid … … 859 858 // get linked cell list 860 859 if (TesselStruct[i] == NULL) { 861 eLog() << Verbose( 1) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;860 eLog() << Verbose(0) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl; 862 861 FillIt = false; 863 862 } else { 864 FillIt = FillIt && (!TesselStruct[i]->IsInnerPoint(CurrentPosition, LCList[i])); 863 const double distance = (TesselStruct[i]->GetDistanceSquaredToSurface(CurrentPosition, LCList[i])); 864 FillIt = FillIt && (distance > boundary*boundary); 865 if (FillIt) { 866 Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is outer point." << endl; 867 } else { 868 Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is inner point or within boundary." << endl; 869 break; 870 } 865 871 i++; 866 872 } … … 931 937 } 932 938 Free(&M); 939 940 // output to file 941 TesselStruct[0]->LastTriangle = NULL; 942 StoreTrianglesinFile(Filling, TesselStruct[0], "Tesselated", ".dat"); 943 933 944 for (size_t i=0;i<List->ListOfMolecules.size();i++) { 934 945 delete(LCList[i]);
Note:
See TracChangeset
for help on using the changeset viewer.