~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to tests/fvm_sizes_test.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*============================================================================
 
2
 * Unit test for some FVM global numbering issues;
 
3
 *============================================================================*/
 
4
 
 
5
/*
 
6
  This file is part of Code_Saturne, a general-purpose CFD tool.
 
7
 
 
8
  Copyright (C) 1998-2011 EDF S.A.
 
9
 
 
10
  This program is free software; you can redistribute it and/or modify it under
 
11
  the terms of the GNU General Public License as published by the Free Software
 
12
  Foundation; either version 2 of the License, or (at your option) any later
 
13
  version.
 
14
 
 
15
  This program is distributed in the hope that it will be useful, but WITHOUT
 
16
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
17
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
18
  details.
 
19
 
 
20
  You should have received a copy of the GNU General Public License along with
 
21
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
22
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
23
*/
 
24
 
 
25
/*----------------------------------------------------------------------------*/
 
26
 
 
27
#if defined(HAVE_CONFIG_H)
 
28
#include "cs_config.h"
 
29
#endif
 
30
 
 
31
#include <stdio.h>
 
32
#include <stdlib.h>
 
33
#include <string.h>
 
34
 
 
35
#include <bft_error.h>
 
36
#include <bft_printf.h>
 
37
 
 
38
#include "fvm_config_defs.h"
 
39
#include "fvm_parall.h"
 
40
#include "fvm_part_to_block.h"
 
41
 
 
42
/*---------------------------------------------------------------------------*/
 
43
 
 
44
/*---------------------------------------------------------------------------*/
 
45
 
 
46
int
 
47
main (int argc, char *argv[])
 
48
{
 
49
  int i, j;
 
50
  int rank_id[] = {0, 1024, 2048, 4095};
 
51
  int n_ranks = 4096;
 
52
  fvm_gnum_t n_g_ents[] = {500, 1100000000, 2200000000,5400000000};
 
53
 
 
54
  fvm_part_to_block_info_t bi;
 
55
 
 
56
  for (i = 0; i < 4; i++) {
 
57
 
 
58
    int64_t g_ent_id = 0;
 
59
    int l_rank_id = 0;
 
60
 
 
61
    bft_printf("\ntest for n_g_ents = %llu\n",
 
62
               (unsigned long long)(n_g_ents[i]));
 
63
    for (j = 0; j < 4; j++) {
 
64
      bi = fvm_part_to_block_compute_sizes(rank_id[j],
 
65
                                           n_ranks,
 
66
                                           0,
 
67
                                           1024*1024,
 
68
                                           n_g_ents[i]);
 
69
      bft_printf("%d/%d [%llu %llu] block step %d, block size %d\n",
 
70
                 rank_id[j], n_ranks, (unsigned long long)(bi.gnum_range[0]),
 
71
                 (unsigned long long)(bi.gnum_range[1]),
 
72
                 (int)(bi.rank_step), (int)(bi.block_size));
 
73
    }
 
74
 
 
75
    g_ent_id = n_g_ents[i] - 1;
 
76
    l_rank_id = g_ent_id/bi.block_size * bi.rank_step;
 
77
    bft_printf("\nrank id for ent_id = %llu: %d\n",
 
78
               (unsigned long long)g_ent_id, l_rank_id);
 
79
  }
 
80
 
 
81
  exit(EXIT_SUCCESS);
 
82
}