1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
13 * reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 *
20 *
21 * This file is almost a complete re-write for Open MPI compared to the
22 * original mpiJava package. Its license and copyright are listed below.
23 * See <path to ompi/mpi/java/README> for more information.
24 *
25 *
26 * Licensed under the Apache License, Version 2.0 (the "License");
27 * you may not use this file except in compliance with the License.
28 * You may obtain a copy of the License at
29 *
30 * http://www.apache.org/licenses/LICENSE-2.0
31 *
32 * Unless required by applicable law or agreed to in writing, software
33 * distributed under the License is distributed on an "AS IS" BASIS,
34 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 * See the License for the specific language governing permissions and
36 * limitations under the License.
37 *
38 *
39 * File : CartParms.java
40 * Author : Xinying Li
41 * Created : Thu Apr 9 12:22:15 1998
42 * Revision : $Revision: 1.1 $
43 * Updated : $Date: 1998/08/26 18:49:50 $
44 * Copyright: Northeast Parallel Architectures Center
45 * at Syracuse University 1998
46 */
47
48 package mpi;
49
50 /**
51 * Cartesian topology information associated with a communicator.
52 */
53 public final class CartParms
54 {
55 /** Number of processes for each cartesian dimension. */
56 private final int[] dims;
57
58 /** Periodicity (true/false) for each cartesian dimension. */
59 private final boolean[] periods;
60
61 /** Coordinates of calling process in cartesian structure. */
62 private final int[] coords;
63
64 /**
65 * Constructs a cartesian topology information object.
66 * @param dims number of processes for each cartesian dimension.
67 * @param periods periodicity (true/false) for each cartesian dimension.
68 * @param coords coordinates of calling process in cartesian structure.
69 */
70 protected CartParms(int[] dims, boolean[] periods, int[] coords)
71 {
72 this.dims = dims;
73 this.periods = periods;
74 this.coords = coords;
75 }
76
77 /**
78 * Returns the number of dimensions.
79 * @return number of dimensions.
80 */
81 public int getDimCount()
82 {
83 return dims.length;
84 }
85
86 /**
87 * Returns the number of processes for a cartesian dimension.
88 * @param i cartesian dimension.
89 * @return number of processes for a cartesian dimension.
90 */
91 public int getDim(int i)
92 {
93 return dims[i];
94 }
95
96 /**
97 * Returns the periodicity (true/false) for a cartesian dimension.
98 * @param i cartesian dimension.
99 * @return periodicity for a cartesian dimension.
100 */
101 public boolean getPeriod(int i)
102 {
103 return periods[i];
104 }
105
106 /**
107 * Returns the coordinate of calling process for a cartesian dimension.
108 * @param i cartesian dimension.
109 * @return coordinate of calling process for a cartesian dimension.
110 */
111 public int getCoord(int i)
112 {
113 return coords[i];
114 }
115
116 } // CartParms