Statistiques
| Révision :

root / bin / compute_stress_anticlinal.cpp @ 1

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

1 1 akiss
#include "compute_stress_anticlinal.h"
2 1 akiss
#include "constants.h"
3 1 akiss
#include <stdio.h>
4 1 akiss
5 1 akiss
/* this function computes the stress on a cell by interpolating the forces on its vertices */
6 1 akiss
7 1 akiss
void compute_stress_anticlinal(int wall_index, double *vertices, int *vertices_number_in_each_cell, int cell_number, double *stress_anticlinal,
8 1 akiss
                                int *wall_vertices, int *cell_walls, double *lengths, double *target_lengths){
9 1 akiss
10 1 akiss
double projection[3];
11 1 akiss
projection[0]=(vertices[2*wall_vertices[2*wall_index]]-vertices[2*wall_vertices[2*wall_index+1]])*(vertices[2*wall_vertices[2*wall_index]]-vertices[2*wall_vertices[2*wall_index+1]]);
12 1 akiss
projection[1]=(vertices[2*wall_vertices[2*wall_index]+1]-vertices[2*wall_vertices[2*wall_index+1]+1])*(vertices[2*wall_vertices[2*wall_index]+1]-vertices[2*wall_vertices[2*wall_index+1]+1]);
13 1 akiss
projection[2]=(vertices[2*wall_vertices[2*wall_index]+1]-vertices[2*wall_vertices[2*wall_index+1]+1])*(vertices[2*wall_vertices[2*wall_index]]-vertices[2*wall_vertices[2*wall_index+1]]);
14 1 akiss
projection[0]/=lengths[wall_index]*lengths[wall_index];
15 1 akiss
projection[1]/=lengths[wall_index]*lengths[wall_index];
16 1 akiss
projection[2]/=lengths[wall_index]*lengths[wall_index];
17 1 akiss
stress_anticlinal[3*wall_index]=lame_first_anticlinal*(lengths[wall_index]-target_lengths[wall_index])*projection[0]/target_lengths[wall_index];
18 1 akiss
stress_anticlinal[3*wall_index+1]=lame_first_anticlinal*(lengths[wall_index]-target_lengths[wall_index])*projection[1]/target_lengths[wall_index];
19 1 akiss
stress_anticlinal[3*wall_index+2]=lame_first_anticlinal*(lengths[wall_index]-target_lengths[wall_index])*projection[2]/target_lengths[wall_index];
20 1 akiss
21 1 akiss
22 1 akiss
}