Changeset 23471
- Timestamp:
- 11/20/18 08:19:42 (6 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp
r23469 r23471 54 54 /*}}}*/ 55 55 AdaptiveMeshRefinement::~AdaptiveMeshRefinement(){/*{{{*/ 56 int writemesh = 1;//itapopo keep 0 57 if(writemesh) this->WriteMesh(); 56 58 this->CleanUp(); 57 59 gRefDBase.clear(); … … 856 858 } 857 859 /*}}}*/ 860 void AdaptiveMeshRefinement::ReadMesh(){/*{{{*/ 861 862 std::string fathermeshfile = "/home/santos/issm_fathermesh.txt"; 863 std::string previousmeshfile = "/home/santos/issm_previousmesh.txt"; 864 std::string amrfile = "/home/santos/issm_amr.txt"; 865 std::ifstream amrifstream(amrfile.c_str()); 866 int size,value; 867 868 TPZPersistenceManager::OpenRead(fathermeshfile); 869 this->fathermesh = dynamic_cast<TPZGeoMesh *>(TPZPersistenceManager::ReadFromFile()); 870 TPZPersistenceManager::CloseRead(); 871 872 TPZPersistenceManager::OpenRead(previousmeshfile); 873 this->previousmesh = dynamic_cast<TPZGeoMesh *>(TPZPersistenceManager::ReadFromFile()); 874 TPZPersistenceManager::CloseRead(); 875 876 if(!amrifstream.is_open()) _error_("amr ifstream is not open!"); 877 amrifstream.seekg(0); 878 879 this->sid2index.clear(); 880 this->index2sid.clear(); 881 this->specialelementsindex.clear(); 882 883 amrifstream>>size; 884 for(int i=0;i<size;i++){ 885 amrifstream>>value; 886 this->sid2index.push_back(value); 887 } 888 889 amrifstream>>size; 890 for(int i=0;i<size;i++){ 891 amrifstream>>value; 892 this->index2sid.push_back(value); 893 } 894 895 amrifstream>>size; 896 for(int i=0;i<size;i++){ 897 amrifstream>>value; 898 this->specialelementsindex.push_back(value); 899 } 900 } 901 /*}}}*/ 902 void AdaptiveMeshRefinement::WriteMesh(){/*{{{*/ 903 904 std::string fathermeshfile = "/home/santos/issm_fathermesh.txt"; 905 std::string previousmeshfile = "/home/santos/issm_previousmesh.txt"; 906 std::string amrfile = "/home/santos/issm_amr.txt"; 907 std::ofstream amrofstream(amrfile.c_str()); 908 909 if(this->fathermesh){ 910 TPZPersistenceManager::OpenWrite(fathermeshfile); 911 TPZPersistenceManager::WriteToFile(this->fathermesh); 912 TPZPersistenceManager::CloseWrite(); 913 } 914 915 if(this->previousmesh){ 916 TPZPersistenceManager::OpenWrite(previousmeshfile); 917 TPZPersistenceManager::WriteToFile(this->previousmesh); 918 TPZPersistenceManager::CloseWrite(); 919 } 920 921 if(this->sid2index.size()>0){ 922 amrofstream << this->sid2index.size() << std::endl; 923 for(int i=0;i<this->sid2index.size();i++) { 924 amrofstream << this->sid2index[i] << std::endl; 925 } 926 } 927 928 if(this->index2sid.size()>0){ 929 amrofstream << this->index2sid.size() << std::endl; 930 for(int i=0;i<this->index2sid.size();i++) { 931 amrofstream << this->index2sid[i] << std::endl; 932 } 933 } 934 935 if(this->specialelementsindex.size()){ 936 amrofstream << this->specialelementsindex.size() << std::endl; 937 for(int i=0;i<this->specialelementsindex.size();i++) { 938 amrofstream << this->specialelementsindex[i] << std::endl; 939 } 940 } 941 amrofstream.flush(); 942 amrofstream.close(); 943 } 944 /*}}}*/ -
issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h
r23469 r23471 70 70 void CreateInitialMesh(int &nvertices,int &nelements,double* x,double* y,int* elements); 71 71 void CheckMesh(int** pdata,double** pxy,int** pelements); 72 void ReadMesh(); 73 void WriteMesh(); 72 74 /*}}}*/ 73 75 private: -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r23469 r23471 5329 5329 IssmDouble* z = NULL; 5330 5330 int* elements = NULL; 5331 int amr_restart; 5331 5332 5332 5333 /*Initialize field as NULL for now*/ … … 5356 5357 this->parameters->FindParam(&this->amr->deviatoricerror_maximum,AmrDeviatoricErrorMaximumEnum); 5357 5358 if(my_rank==0){ 5358 this->amr->CreateInitialMesh(numberofvertices,numberofelements,x,y,elements); 5359 this->parameters->FindParam(&amr_restart,AmrRestartEnum); 5360 if(amr_restart){//experimental 5361 this->amr->ReadMesh(); 5362 } else {//this is the default method 5363 this->amr->CreateInitialMesh(numberofvertices,numberofelements,x,y,elements); 5364 } 5359 5365 } 5360 5366
Note:
See TracChangeset
for help on using the changeset viewer.