Xpetra Version of the Day
Loading...
Searching...
No Matches
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
54namespace Xpetra {
55
61template<class LocalOrdinal,
62 class GlobalOrdinal,
65{
66
67
68 private:
69
70
73
74
75 public:
76
77
79
80
83 global_size_t numGlobalElements,
84 GlobalOrdinal indexBase,
85 const Teuchos::RCP<const Teuchos::Comm<int>>& comm,
87
88
90
91
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
105 global_size_t numGlobalElements,
107 GlobalOrdinal indexBase,
108 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
109
110
123 const LocalOrdinal numDofPerNode,
124 const GlobalOrdinal gidOffset = Teuchos::ScalarTraits<GlobalOrdinal>::zero());
125
126
127#ifdef HAVE_XPETRA_TPETRA
130 global_size_t numGlobalElements,
131 const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
132 GlobalOrdinal indexBase,
133 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
134#endif
135
136
140 size_t numElements,
141 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
142
143
145
146
149 size_t numElements,
150 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
151
152
154
155
158 global_size_t numElements,
159 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
160
161
165 global_size_t numElements,
166 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
167
168
172 global_size_t numElements,
173 size_t localNumElements,
174 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
175
176
178
179
182 global_size_t numElements,
183 size_t localNumElements,
184 const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
185
187 // for this map.
190 const Teuchos::RCP<const Teuchos::Comm<int>>& newComm);
191
192}; // class MapFactory
193
194
195
199
200
201#if defined(HAVE_XPETRA_EPETRA)
202
203
204#if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
205
206
207 template <>
208 class MapFactory<int, int, EpetraNode>
209 {
210
211 typedef int LocalOrdinal;
212 typedef int GlobalOrdinal;
214
215 private:
216
218 MapFactory();
219
220 public:
221
222
223
224
226 Build (UnderlyingLib lib,
227 global_size_t numGlobalElements,
228 int indexBase,
229 const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
231
232
233
234
236 Build (UnderlyingLib lib,
237 global_size_t numGlobalElements,
238 size_t numLocalElements,
239 int indexBase,
240 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
241
242
243
244
247 global_size_t numGlobalElements,
249 int indexBase,
250 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
251
264 const LocalOrdinal numDofPerNode,
266
267
270 size_t numElements,
271 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
272
273
274 // TODO remove this
275
276
279 size_t numElements,
280 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
281
282
283 // TODO remove this
284
285
286
289 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
290
291
294 global_size_t numElements,
295 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
296
297
300 global_size_t numElements,
301 size_t localNumElements,
302 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
303
304
305
306
309 global_size_t numElements,
310 size_t localNumElements,
311 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
312
315 const Teuchos::RCP<const Teuchos::Comm<int>>& newComm);
316
317
318 }; // class MapFactory<int, int ... > specialization
319
320
321#endif // #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
322
323
324
325
326
327
328// we need the Epetra specialization only if Epetra is enabled
329#if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
330
331
332 template <>
333 class MapFactory<int, long long, EpetraNode>
334 {
335
336 typedef int LocalOrdinal;
337 typedef long long GlobalOrdinal;
339
340 private:
341
344
345 public:
346
347
348
351 global_size_t numGlobalElements,
352 int indexBase,
353 const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
355
356
357
358
361 global_size_t numGlobalElements,
362 size_t numLocalElements,
363 int indexBase,
364 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
365
366
367
368
371 global_size_t numGlobalElements,
373 int indexBase,
374 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
375
376
381 LocalOrdinal numDofPerNode);
382
383
386 size_t numElements,
387 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
388
389
390
391
394 size_t numElements,
395 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
396
397
398
399
402 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
403
404
407 global_size_t numElements,
408 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
409
410
413 global_size_t numElements,
414 size_t localNumElements,
415 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
416
417
418
419
422 global_size_t numElements,
423 size_t localNumElements,
424 const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
425
428 const Teuchos::RCP<const Teuchos::Comm<int>>& newComm);
429
430
431 }; // class MapFactory<int, long long, EpetraNode> specialization
432
433
434#endif // #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
435
436
437#endif // #if defined(HAVE_XPETRA_EPETRA)
438
439
440} // namespace Xpetra
441
442
443#define XPETRA_MAPFACTORY_SHORT
444
445#endif // XPETRA_MAPFACTORY_DECL_HPP
446
447// TODO: removed unused methods
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMap(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
static RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, int indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, LocalOrdinal numDofPerNode)
static RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, int indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > copyMapWithNewComm(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &oldmap, const Teuchos::RCP< const Teuchos::Comm< int > > &newComm)
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMap(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
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)
MapFactory()
Private constructor. This is a static class.
static RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, size_t numLocalElements, int indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
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 an Xpetra::Map instance.
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.
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 > > 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.
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.
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 > > copyMapWithNewComm(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &oldmap, const Teuchos::RCP< const Teuchos::Comm< int > > &newComm)
Create a copy of the map, only using the new Comm object if the Comm would be valid.
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.
MapFactory()
Private constructor. This is a static class.
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.
Xpetra namespace
size_t global_size_t
Global size_t object.