source: branches/stable/MULTI_PROBE/MP_probe_tabs.cxx

Last change on this file was 16766, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1// ============================================================= //
2//                                                               //
3//   File      : MP_probe_tabs.cxx                               //
4//   Purpose   :                                                 //
5//                                                               //
6//   Institute of Microbiology (Technical University Munich)     //
7//   http://www.arb-home.de/                                     //
8//                                                               //
9// ============================================================= //
10
11#include "MP_probe.hxx"
12#include "MultiProbe.hxx"
13
14#include <cmath>
15
16// **************************************************************
17void probe_tabs::print() {
18    int i;
19
20
21    printf("**********************\n");
22    printf("GRUPPENTABELLE:\n");
23    for (i=0; i< length_of_group_tabs; i++)
24        printf("%d  %d \n", i, group_tab[i]);
25
26    printf("NON_GRUPPENTABELLE:\n");
27    for (i=0; i< length_of_group_tabs; i++)
28        printf("%d %d\n", i, non_group_tab[i]);
29
30    printf("**********************\n");
31
32}
33
34probe_tabs *probe_tabs::duplicate() {
35    int  i;
36    int *new_group_field     = new int[length_of_group_tabs];
37    int *new_non_group_field = new int[length_of_group_tabs];
38
39    for (i=0; i< length_of_group_tabs; i++) // LOOP_VECTORIZED[!<5.0]
40        new_group_field[i] = group_tab[i];
41
42
43    for (i=0; i< length_of_group_tabs; i++) // LOOP_VECTORIZED[!<5.0]
44        new_non_group_field[i] = non_group_tab[i];
45
46    return  new probe_tabs(new_group_field, new_non_group_field, length_of_group_tabs);
47}
48
49
50probe_tabs::probe_tabs(int *new_group_field, int *new_non_group_field, int len_group) {
51    int length;
52    memset((void*)this, 0, sizeof(probe_tabs)); // @@@ potentially dangerous (overwrites vtable pointer!)
53
54    if (new_group_field) { // Duplicate !!!
55        group_tab = new_group_field;
56        non_group_tab = new_non_group_field;
57        length_of_group_tabs = len_group;
58    }
59    else {
60        length = (int)(pow(3.0, (double)mp_gl_awars.no_of_probes));
61        group_tab = new int[length];
62        memset(group_tab, 0, sizeof(int)*length);
63        non_group_tab = new int[length];
64        memset(non_group_tab, 0, sizeof(int)*length);
65        length_of_group_tabs = length;
66    }
67}
68
69probe_tabs::~probe_tabs() {
70    delete [] group_tab;
71    delete [] non_group_tab;
72}
Note: See TracBrowser for help on using the repository browser.