Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_MapFactory_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_MAPFACTORY_DECL_HPP
47 #define XPETRA_MAPFACTORY_DECL_HPP
48 
49 #include "Xpetra_ConfigDefs.hpp"
50 
51 #include "Xpetra_Map_decl.hpp"
52 #include "Xpetra_Exceptions.hpp"
53 
54 namespace Xpetra {
55 
61 template<class LocalOrdinal,
62  class GlobalOrdinal,
63  class Node = typename Map<LocalOrdinal, GlobalOrdinal>::node_type>
65 {
66 
67 
68  private:
69 
70 
73 
74 
75  public:
76 
77 
79 
80 
81  static Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
82  Build(UnderlyingLib lib,
83  global_size_t numGlobalElements,
84  GlobalOrdinal indexBase,
85  const Teuchos::RCP<const Teuchos::Comm<int>>& comm,
87 
88 
90 
91 
92  static Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
93  Build(UnderlyingLib lib,
94  global_size_t numGlobalElements,
95  size_t numLocalElements,
96  GlobalOrdinal indexBase,
97  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
98 
99 
101 
102 
103  static Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
104  Build(UnderlyingLib lib,
105  global_size_t numGlobalElements,
106  const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
107  GlobalOrdinal indexBase,
108  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
109 
110 
113  static Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
114  Build(const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node>>& map,
115  LocalOrdinal numDofPerNode);
116 
117 
118 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
119 #ifdef HAVE_XPETRA_TPETRA
120  static Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
121  Build(UnderlyingLib lib,
122  global_size_t numGlobalElements,
123  const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
124  GlobalOrdinal indexBase,
125  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
126 #endif
127 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
128 
129 
131  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
133  size_t numElements,
134  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
135 
136 
138 
139 
140  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
142  size_t numElements,
143  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
144 
145 
147 
148 
149  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
151  global_size_t numElements,
152  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
153 
154 
156  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
158  global_size_t numElements,
159  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
160 
161 
163  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
165  global_size_t numElements,
166  size_t localNumElements,
167  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
168 
169 
171 
172 
173  static Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
175  global_size_t numElements,
176  size_t localNumElements,
177  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
178 
179 
180 }; // class MapFactory
181 
182 
183 
187 
188 
189 #if defined(HAVE_XPETRA_EPETRA)
190 
191 
192 #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
193 
194 
195  template <>
196  class MapFactory<int, int, EpetraNode>
197  {
198 
199  typedef int LocalOrdinal;
200  typedef int GlobalOrdinal;
201  typedef EpetraNode Node;
202 
203  private:
204 
206  MapFactory();
207 
208  public:
209 
210 
211 
212 
213  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
214  Build (UnderlyingLib lib,
215  global_size_t numGlobalElements,
216  int indexBase,
217  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
219 
220 
221 
222 
223  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
224  Build (UnderlyingLib lib,
225  global_size_t numGlobalElements,
226  size_t numLocalElements,
227  int indexBase,
228  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
229 
230 
231 
232 
233  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
234  Build(UnderlyingLib lib,
235  global_size_t numGlobalElements,
236  const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
237  int indexBase,
238  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
239 
242  static Teuchos::RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
243  Build(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& map,
244  LocalOrdinal numDofPerNode);
245 
246 
247  static Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal, Node> >
249  size_t numElements,
250  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
251 
252 
253  // TODO remove this
254 
255 
256  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
258  size_t numElements,
259  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
260 
261 
262  // TODO remove this
263 
264 
265 
266  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
268  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
269 
270 
271  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
273  global_size_t numElements,
274  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
275 
276 
277  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
279  global_size_t numElements,
280  size_t localNumElements,
281  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
282 
283 
284 
285 
286  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
288  global_size_t numElements,
289  size_t localNumElements,
290  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
291 
292  }; // class MapFactory<int, int ... > specialization
293 
294 
295 #endif // #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
296 
297 
298 
299 
300 
301 
302 // we need the Epetra specialization only if Epetra is enabled
303 #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
304 
305 
306  template <>
307  class MapFactory<int, long long, EpetraNode>
308  {
309 
310  typedef int LocalOrdinal;
311  typedef long long GlobalOrdinal;
312  typedef EpetraNode Node;
313 
314  private:
315 
317  MapFactory();
318 
319  public:
320 
321 
322 
323  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
324  Build (UnderlyingLib lib,
325  global_size_t numGlobalElements,
326  int indexBase,
327  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
329 
330 
331 
332 
333  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
334  Build (UnderlyingLib lib,
335  global_size_t numGlobalElements,
336  size_t numLocalElements,
337  int indexBase,
338  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
339 
340 
341 
342 
343  static RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
344  Build(UnderlyingLib lib,
345  global_size_t numGlobalElements,
346  const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
347  int indexBase,
348  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
349 
350 
353  static Teuchos::RCP<Map<LocalOrdinal,GlobalOrdinal, Node> >
354  Build(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& map,
355  LocalOrdinal numDofPerNode);
356 
357 
358  static Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal, Node> >
360  size_t numElements,
361  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
362 
363 
364 
365 
366  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
368  size_t numElements,
369  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
370 
371 
372 
373 
374  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
376  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
377 
378 
379  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
381  global_size_t numElements,
382  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
383 
384 
385  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
387  global_size_t numElements,
388  size_t localNumElements,
389  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
390 
391 
392 
393 
394  static Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal, Node> >
396  global_size_t numElements,
397  size_t localNumElements,
398  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
399 
400  }; // class MapFactory<int, long long, EpetraNode> specialization
401 
402 
403 #endif // #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
404 
405 
406 #endif // #if defined(HAVE_XPETRA_EPETRA)
407 
408 
409 } // namespace Xpetra
410 
411 
412 #define XPETRA_MAPFACTORY_SHORT
413 
414 #endif // XPETRA_MAPFACTORY_DECL_HPP
415 
416 // TODO: removed unused methods
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMap(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a locally replicated Map with the default node.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMap(UnderlyingLib lib, global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a (potentially) non-uniform, contiguous Map with the default node.
MapFactory()
Private constructor. This is a static class.
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int >> &comm, LocalGlobal lg=Xpetra::GloballyDistributed)
Map constructor with Xpetra-defined contiguous uniform distribution.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(UnderlyingLib lib, global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a (potentially) non-uniform, contiguous Map with a user-specified node.
size_t global_size_t
Global size_t object.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a uniform, contiguous Map with a user-specified node.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a locally replicated Map with a specified node.
Create an Xpetra::Map instance.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMap(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a uniform, contiguous Map with the default node.