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