Statistiques
| Révision :

root / bin / compute_cell_areas.cpp @ 1

Historique | Voir | Annoter | Télécharger (693 octet)

1 1 akiss
#include <math.h>
2 1 akiss
#include "constants.h"
3 1 akiss
#include "compute_cell_areas.h"
4 1 akiss
#include <stdio.h>
5 1 akiss
#include <stdlib.h>
6 1 akiss
7 1 akiss
/* this function computes the areas of each cell, knowing the areas of each triangles between two vertices and the barycenter */
8 1 akiss
9 1 akiss
void compute_cell_areas(double *vertices, int *cells_vertices, int *vertices_number_in_each_cell,
10 1 akiss
                    int cell_number, double *areas, double *cell_areas){
11 1 akiss
12 1 akiss
int i,j;
13 1 akiss
14 1 akiss
/* usual loop over the cells, then over the vertices of each cell */
15 1 akiss
for (i=0;i<cell_number;i++){cell_areas[i]=0;
16 1 akiss
    for (j=vertices_number_in_each_cell[i];j<vertices_number_in_each_cell[i+1];j++){
17 1 akiss
        cell_areas[i]+=areas[j];
18 1 akiss
        }
19 1 akiss
}
20 1 akiss
21 1 akiss
}