Changeset 10388


Ignore:
Timestamp:
10/31/11 16:17:54 (13 years ago)
Author:
Mathieu Morlighem
Message:

Forgot to divide by norm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/shared/Elements/CoordinateSystemTransform.cpp

    r10367 r10388  
    33 */
    44#include "./elements.h"
     5#include <math.h>
    56
    67void CoordinateSystemTransform(double** ptransform,Node** nodes,int numnodes,int dimension){
    78
    89        int     i;
     10        double  x_norm,y_norm;
    911        double *transform         = NULL;
    1012        double *values            = NULL;
     
    3133                nodes[i]->GetCoordinateSystem(&coord_system[0][0]);
    3234                if(dimension==2){
    33                         transform[(dimension*numnodes)*(i*dimension+0) + i*dimension+0] = coord_system[0][0];
    34                         transform[(dimension*numnodes)*(i*dimension+0) + i*dimension+1] = coord_system[0][1];
    35                         transform[(dimension*numnodes)*(i*dimension+1) + i*dimension+0] = coord_system[1][0];
    36                         transform[(dimension*numnodes)*(i*dimension+1) + i*dimension+1] = coord_system[1][1];
     35                        /*We remove the z component, we need to renormalize x and y*/
     36                        x_norm = sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]);
     37                        y_norm = sqrt( coord_system[0][1]*coord_system[0][1] + coord_system[1][1]*coord_system[1][1]);
     38                        transform[(dimension*numnodes)*(i*dimension+0) + i*dimension+0] = coord_system[0][0]/x_norm;
     39                        transform[(dimension*numnodes)*(i*dimension+0) + i*dimension+1] = coord_system[0][1]/y_norm;
     40                        transform[(dimension*numnodes)*(i*dimension+1) + i*dimension+0] = coord_system[1][0]/x_norm;
     41                        transform[(dimension*numnodes)*(i*dimension+1) + i*dimension+1] = coord_system[1][1]/y_norm;
    3742                }
    3843                else if(dimension==3){
Note: See TracChangeset for help on using the changeset viewer.