Loading include/ProDataIO.h +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include <iomanip> int ReadTecplotNormalData(string &file, Table_t &table); int ReadTecplotNormalData(string &file, Table_t &table, string &secLine); void WriteTecplotNormalData(const LineList_t &list, const string &file, double precision = 6); Loading src/HandleExtendedDislocation.cpp +121 −76 Original line number Diff line number Diff line Loading @@ -20,16 +20,17 @@ void HandleExtendedDislocation(InArgs_t *inArgs) real8 cubel = 20000, boundMin[3], boundMax[3]; real8 remeshSize = 20.0, burgID1 = 7, burgID2 = 12; real8 rd, yi1, yj1, yk2, yk3, s; int index, i, j, k; int index, i, j, k, file, iPos; int colX, colY, colBurgID; string cubelName = "cubel", burgIDName = "burgID", remeshSizeName = "rsize"; string fileName; real8 separation = 0.0; string fileName, secLine, fdir, curDir("./"), fname, aveFile; real8 separation = 0.0, position = 0.0; Point_t p; vector<Point_t> points1, points2; Curve_t curve1, curve2; LineList_t list; vector<string> words; vector<real8> seq; vector<vector<double> > data(7); Loading @@ -46,6 +47,15 @@ void HandleExtendedDislocation(InArgs_t *inArgs) } printf("The cubel size is %f\n", cubel); if(inArgs->outFiles.size() < 2){ aveFile = "Ave.plt"; }else{ aveFile = inArgs->outFiles[1]; } ofstream out; out.open(aveFile.c_str(), ios::out); out << "variables = timeNow, separation, position" << endl; boundMin[0] = -0.5*cubel; boundMin[1] = -0.5*cubel; boundMin[2] = -0.5*cubel; Loading @@ -67,7 +77,13 @@ void HandleExtendedDislocation(InArgs_t *inArgs) } printf("The remesh size is %f\n", remeshSize); ReadTecplotNormalData(inArgs->inpFiles[0], table); for(file=0; file<inArgs->inpFiles.size(); file++){ vector<string>().swap(table.variables); ReadTecplotNormalData(inArgs->inpFiles[file], table, secLine); vector<string>().swap(words); words = split(secLine, "\""); if(table.data.size() < 2)Fatal("the data size is %d", table.data.size()); Loading @@ -75,6 +91,8 @@ void HandleExtendedDislocation(InArgs_t *inArgs) colY = GetColIDFromTable(table, "Y"); colBurgID = GetColIDFromTable(table, "burgID"); vector<Point_t>().swap(points1); vector<Point_t>().swap(points2); p.x = 1.0E10; p.y = 1.0E10; for(i=0; i<table.data.size(); i++){ if(p.x == table.data[i][colX] && Loading Loading @@ -109,18 +127,26 @@ void HandleExtendedDislocation(InArgs_t *inArgs) curve2.ay[i] = points2[i].y; } vector<double>().swap(seq); seq = GenerateSequence(boundMin[0], boundMax[0], remeshSize); data[0].assign(seq.begin(), seq.end()); for(i=1; i<data.size(); i++) data[i].resize(data[0].size()); data.resize(7); for(i=0; i<data.size(); i++) data[i].resize(seq.size()); for(i=0; i<seq.size(); i++){ data[0][i] = seq[i]; } separation = 0.0; position = 0.0; for(i=0; i<seq.size(); i++){ data[1][i] = LinearInterpolation(curve1, seq[i], boundMin[0], boundMax[0]); data[2][i] = LinearInterpolation(curve2, seq[i], boundMin[0], boundMax[0]); data[3][i] = 0.5 * (data[1][i] + data[2][i]); separation += fabs(data[1][i] - data[2][i]); position += data[3][i]; } separation /= ((double)seq.size()); position /= ((double)seq.size()); for(i=0; i<seq.size(); i++){ data[4][i] = 0.0; Loading @@ -146,7 +172,26 @@ void HandleExtendedDislocation(InArgs_t *inArgs) swap(list.data, data); fileName = inArgs->outFiles[0]; iPos = inArgs->inpFiles[file].find_last_of('/'); if(iPos == string::npos){ fdir = curDir; fname = inArgs->inpFiles[file]; }else{ fdir = curDir + inArgs->inpFiles[file].substr(0,iPos); fname = inArgs->inpFiles[file].substr(iPos+1); } fileName += "-"; fileName += fname; WriteTecplotNormalData(list, fileName, 10); vector<vector<double> >().swap(list.data); out << words[1] << " "; out << setprecision(10) << separation << " "; out << setprecision(10) << position << endl; } return; } Loading src/Main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ static void GetInArgs(int argc, char *argv[], InArgs_t *inArgs) } swap(bakInps, inArgs->inpFiles); sort(inArgs->inpFiles.begin(), inArgs->inpFiles.end()); printf("Input files are:\n"); for(i=0; i<inArgs->inpFiles.size(); i++){ printf("%s \n", inArgs->inpFiles[i].c_str()); Loading src/Math.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ void AverageLines(InArgs_t *inArgs) int record = 0; real8 rsize = 20, min, max; string rsizeName("rsize"), varsName("vars"), recordName("record"); string xName("X"), yName("Y"), str("Ave_"); string xName("X"), yName("Y"), str("Ave_"), secLine; LineList_t list; Curve_t curve; Loading Loading @@ -43,7 +43,7 @@ void AverageLines(InArgs_t *inArgs) printf("The Record (record) state is %d\n", record); for(i=0; i<inArgs->inpFiles.size(); i++){ ReadTecplotNormalData(inArgs->inpFiles[i], tables[i]); ReadTecplotNormalData(inArgs->inpFiles[i], tables[i], secLine); if(i == 0){ colX = GetColIDFromTable(tables[i], xName); colY = GetColIDFromTable(tables[i], yName); Loading src/Parse.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -17,19 +17,19 @@ vector<string> GetFiles(const string &file) char basePath[256], *getcwdReturn; struct dirent *ptr; string f(file), fdir, fname, dname, bpath; string f(file), fdir, fname, dname, bpath, curDir("./"); vector<string> strs; memset(basePath, '\0', sizeof(basePath)); getcwdReturn = getcwd(basePath, sizeof(basePath)); bpath = basePath; // bpath = basePath; iPos = f.find_last_of('/'); if(iPos == string::npos){ fdir = bpath; fdir = curDir; fname = f; }else{ fdir = bpath + '/' + f.substr(0,iPos); fdir = curDir + f.substr(0,iPos); fname = f.substr(iPos+1); } Loading Loading
include/ProDataIO.h +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include <iomanip> int ReadTecplotNormalData(string &file, Table_t &table); int ReadTecplotNormalData(string &file, Table_t &table, string &secLine); void WriteTecplotNormalData(const LineList_t &list, const string &file, double precision = 6); Loading
src/HandleExtendedDislocation.cpp +121 −76 Original line number Diff line number Diff line Loading @@ -20,16 +20,17 @@ void HandleExtendedDislocation(InArgs_t *inArgs) real8 cubel = 20000, boundMin[3], boundMax[3]; real8 remeshSize = 20.0, burgID1 = 7, burgID2 = 12; real8 rd, yi1, yj1, yk2, yk3, s; int index, i, j, k; int index, i, j, k, file, iPos; int colX, colY, colBurgID; string cubelName = "cubel", burgIDName = "burgID", remeshSizeName = "rsize"; string fileName; real8 separation = 0.0; string fileName, secLine, fdir, curDir("./"), fname, aveFile; real8 separation = 0.0, position = 0.0; Point_t p; vector<Point_t> points1, points2; Curve_t curve1, curve2; LineList_t list; vector<string> words; vector<real8> seq; vector<vector<double> > data(7); Loading @@ -46,6 +47,15 @@ void HandleExtendedDislocation(InArgs_t *inArgs) } printf("The cubel size is %f\n", cubel); if(inArgs->outFiles.size() < 2){ aveFile = "Ave.plt"; }else{ aveFile = inArgs->outFiles[1]; } ofstream out; out.open(aveFile.c_str(), ios::out); out << "variables = timeNow, separation, position" << endl; boundMin[0] = -0.5*cubel; boundMin[1] = -0.5*cubel; boundMin[2] = -0.5*cubel; Loading @@ -67,7 +77,13 @@ void HandleExtendedDislocation(InArgs_t *inArgs) } printf("The remesh size is %f\n", remeshSize); ReadTecplotNormalData(inArgs->inpFiles[0], table); for(file=0; file<inArgs->inpFiles.size(); file++){ vector<string>().swap(table.variables); ReadTecplotNormalData(inArgs->inpFiles[file], table, secLine); vector<string>().swap(words); words = split(secLine, "\""); if(table.data.size() < 2)Fatal("the data size is %d", table.data.size()); Loading @@ -75,6 +91,8 @@ void HandleExtendedDislocation(InArgs_t *inArgs) colY = GetColIDFromTable(table, "Y"); colBurgID = GetColIDFromTable(table, "burgID"); vector<Point_t>().swap(points1); vector<Point_t>().swap(points2); p.x = 1.0E10; p.y = 1.0E10; for(i=0; i<table.data.size(); i++){ if(p.x == table.data[i][colX] && Loading Loading @@ -109,18 +127,26 @@ void HandleExtendedDislocation(InArgs_t *inArgs) curve2.ay[i] = points2[i].y; } vector<double>().swap(seq); seq = GenerateSequence(boundMin[0], boundMax[0], remeshSize); data[0].assign(seq.begin(), seq.end()); for(i=1; i<data.size(); i++) data[i].resize(data[0].size()); data.resize(7); for(i=0; i<data.size(); i++) data[i].resize(seq.size()); for(i=0; i<seq.size(); i++){ data[0][i] = seq[i]; } separation = 0.0; position = 0.0; for(i=0; i<seq.size(); i++){ data[1][i] = LinearInterpolation(curve1, seq[i], boundMin[0], boundMax[0]); data[2][i] = LinearInterpolation(curve2, seq[i], boundMin[0], boundMax[0]); data[3][i] = 0.5 * (data[1][i] + data[2][i]); separation += fabs(data[1][i] - data[2][i]); position += data[3][i]; } separation /= ((double)seq.size()); position /= ((double)seq.size()); for(i=0; i<seq.size(); i++){ data[4][i] = 0.0; Loading @@ -146,7 +172,26 @@ void HandleExtendedDislocation(InArgs_t *inArgs) swap(list.data, data); fileName = inArgs->outFiles[0]; iPos = inArgs->inpFiles[file].find_last_of('/'); if(iPos == string::npos){ fdir = curDir; fname = inArgs->inpFiles[file]; }else{ fdir = curDir + inArgs->inpFiles[file].substr(0,iPos); fname = inArgs->inpFiles[file].substr(iPos+1); } fileName += "-"; fileName += fname; WriteTecplotNormalData(list, fileName, 10); vector<vector<double> >().swap(list.data); out << words[1] << " "; out << setprecision(10) << separation << " "; out << setprecision(10) << position << endl; } return; } Loading
src/Main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ static void GetInArgs(int argc, char *argv[], InArgs_t *inArgs) } swap(bakInps, inArgs->inpFiles); sort(inArgs->inpFiles.begin(), inArgs->inpFiles.end()); printf("Input files are:\n"); for(i=0; i<inArgs->inpFiles.size(); i++){ printf("%s \n", inArgs->inpFiles[i].c_str()); Loading
src/Math.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ void AverageLines(InArgs_t *inArgs) int record = 0; real8 rsize = 20, min, max; string rsizeName("rsize"), varsName("vars"), recordName("record"); string xName("X"), yName("Y"), str("Ave_"); string xName("X"), yName("Y"), str("Ave_"), secLine; LineList_t list; Curve_t curve; Loading Loading @@ -43,7 +43,7 @@ void AverageLines(InArgs_t *inArgs) printf("The Record (record) state is %d\n", record); for(i=0; i<inArgs->inpFiles.size(); i++){ ReadTecplotNormalData(inArgs->inpFiles[i], tables[i]); ReadTecplotNormalData(inArgs->inpFiles[i], tables[i], secLine); if(i == 0){ colX = GetColIDFromTable(tables[i], xName); colY = GetColIDFromTable(tables[i], yName); Loading
src/Parse.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -17,19 +17,19 @@ vector<string> GetFiles(const string &file) char basePath[256], *getcwdReturn; struct dirent *ptr; string f(file), fdir, fname, dname, bpath; string f(file), fdir, fname, dname, bpath, curDir("./"); vector<string> strs; memset(basePath, '\0', sizeof(basePath)); getcwdReturn = getcwd(basePath, sizeof(basePath)); bpath = basePath; // bpath = basePath; iPos = f.find_last_of('/'); if(iPos == string::npos){ fdir = bpath; fdir = curDir; fname = f; }else{ fdir = bpath + '/' + f.substr(0,iPos); fdir = curDir + f.substr(0,iPos); fname = f.substr(iPos+1); } Loading