Statistiques
| Révision :

root / bin / compute_stress_periclinal.cpp @ 1

Historique | Voir | Annoter | Télécharger (1,07 ko)

1
#include <math.h>
2
#include "compute_stress_periclinal.h"
3
#include "constants.h"
4
#include <stdio.h>
5

    
6
/* this function computes the stress on a cell by interpolating the forces on its vertices */
7

    
8
void compute_stress_periclinal(int cell_index, double *vertices, int *vertices_number_in_each_cell, int cell_number, double *stress,
9
                      double *shapes, double *targets, double *cell_areas, int *wall_vertices, int *cell_walls, double *lengths, double *target_lengths){
10

    
11
double trace=targets[3*cell_index]+targets[3*cell_index+1];
12
stress[3*cell_index]=(shear_modulus+lame_first_periclinal)*(shapes[3*cell_index]-targets[3*cell_index])+lame_first_periclinal*(shapes[3*cell_index+1]-targets[3*cell_index+1]);
13
stress[3*cell_index+1]=(shear_modulus+lame_first_periclinal)*(shapes[3*cell_index+1]-targets[3*cell_index+1])+lame_first_periclinal*(shapes[3*cell_index]-targets[3*cell_index]);
14
stress[3*cell_index+2]=shear_modulus*(shapes[3*cell_index+2]-targets[3*cell_index+2]);
15

    
16
stress[3*cell_index]*=2./trace;
17
stress[3*cell_index+1]*=2./trace;
18
stress[3*cell_index+2]*=2./trace;
19

    
20
}