Commit c4223227 authored by DeAn Wei's avatar DeAn Wei
Browse files

sure that fix the bug of periodical boundary.

parent a7285031
Loading
Loading
Loading
Loading
+37 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ void HandleExtendedDislocation_DDD(InArgs_t *inArgs)
    real8           rd, yi1, yj1, yk2, yk3, s;
    int             index,  i, j, k, file, iPos;
    int             colX, colY, colBurgID;
    bool            plu, min;
    string          cubelName = "cubel", burgIDName = "burgID", remeshSizeName = "rsize";  
    string          fileName, secLine, fdir, curDir("./"), fname, aveFile;
    real8           separation = 0.0, position = 0.0;
@@ -33,6 +34,7 @@ void HandleExtendedDislocation_DDD(InArgs_t *inArgs)
    
    vector<string>          words;
    vector<real8>           seq;
    vector<bool>            changed1, changed2;
    vector<vector<double> > data(7);  

    list.variables.push_back("x");
@@ -137,11 +139,36 @@ void HandleExtendedDislocation_DDD(InArgs_t *inArgs)
            data[0][i] = seq[i];
        }
        
        plu = 0; min = 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]);
            if(data[1][i] > 0 || data[2][i] > 0)plu = 1;
            if(data[1][i] < 0 || data[2][i] < 0)min = 1;
        }

        if(plu && min){
            changed1.resize(seq.size());
            changed2.resize(seq.size());
            for(i=0; i<seq.size(); i++){
                if(data[1][i] > 0){
                    changed1[i] = 1;
                    data[1][i] -= cubel;
                }else {
                    changed1[i] = 0;
                }
                if(data[2][i] > 0){
                    changed2[i] = 1;
                    data[2][i] -= cubel;
                }else {
                    changed2[i] = 0;
                }
            }
        }

        separation = 0.0;
        position = 0.0;
        for(i=0; i<seq.size(); i++){
            data[1][i] = linearinterpolation(curve1, seq[i], boundmin[0], boundmax[0]) - cubel;
            data[2][i] = linearinterpolation(curve2, seq[i], boundmin[0], boundmax[0]) - cubel;
            data[3][i] = 0.5 * (data[1][i] + data[2][i]);
            if(i<seq.size()-2){
                separation += fabs(data[1][i] - data[2][i]);  
@@ -150,7 +177,7 @@ void HandleExtendedDislocation_DDD(InArgs_t *inArgs)
        }
        separation /= ((double)(seq.size()-1));
        position /= ((double)(seq.size()-1));
        position += cubel;
        if(position < boundMin[1])position += cubel;

        for(i=0; i<seq.size(); i++){
            data[4][i] = 0.0;
@@ -169,9 +196,13 @@ void HandleExtendedDislocation_DDD(InArgs_t *inArgs)
 
        for(i=0; i<seq.size(); i++){
            data[0][i] += 0.5*cubel;
            if(changed1[i]){
                data[1][i] += cubel;
            }
            if(changed2[i]){
                data[2][i] += cubel;
            data[3][i] += cubel;
            }

            data[4][i] /= ((double)seq.size());
            data[5][i] /= ((double)seq.size());
            data[6][i] /= ((double)seq.size());