Xpetra  Version of the Day
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 
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 
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 
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 
123  const LocalOrdinal numDofPerNode,
124  const GlobalOrdinal gidOffset = Teuchos::ScalarTraits<GlobalOrdinal>::zero());
125 
126 
127 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
128 #ifdef HAVE_XPETRA_TPETRA
130  Build(UnderlyingLib lib,
131  global_size_t numGlobalElements,
132  const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
133  GlobalOrdinal indexBase,
134  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
135 #endif
136 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
137 
138 
142  size_t numElements,
143  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
144 
145 
147 
148 
151  size_t numElements,
152  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
153 
154 
156 
157 
160  global_size_t numElements,
161  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
162 
163 
167  global_size_t numElements,
168  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
169 
170 
174  global_size_t numElements,
175  size_t localNumElements,
176  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
177 
178 
180 
181 
184  global_size_t numElements,
185  size_t localNumElements,
186  const Teuchos::RCP<const Teuchos::Comm<int>>& comm);
187 
188 
189 }; // class MapFactory
190 
191 
192 
196 
197 
198 #if defined(HAVE_XPETRA_EPETRA)
199 
200 
201 #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
202 
203 
204  template <>
205  class MapFactory<int, int, EpetraNode>
206  {
207 
208  typedef int LocalOrdinal;
209  typedef int GlobalOrdinal;
210  typedef EpetraNode Node;
211 
212  private:
213 
215  MapFactory();
216 
217  public:
218 
219 
220 
221 
223  Build (UnderlyingLib lib,
224  global_size_t numGlobalElements,
225  int indexBase,
226  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
228 
229 
230 
231 
233  Build (UnderlyingLib lib,
234  global_size_t numGlobalElements,
235  size_t numLocalElements,
236  int indexBase,
237  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
238 
239 
240 
241 
243  Build(UnderlyingLib lib,
244  global_size_t numGlobalElements,
245  const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
246  int indexBase,
247  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
248 
261  const LocalOrdinal numDofPerNode,
263 
264 
267  size_t numElements,
268  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
269 
270 
271  // TODO remove this
272 
273 
276  size_t numElements,
277  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
278 
279 
280  // TODO remove this
281 
282 
283 
286  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
287 
288 
291  global_size_t numElements,
292  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
293 
294 
297  global_size_t numElements,
298  size_t localNumElements,
299  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
300 
301 
302 
303 
306  global_size_t numElements,
307  size_t localNumElements,
308  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
309 
310  }; // class MapFactory<int, int ... > specialization
311 
312 
313 #endif // #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
314 
315 
316 
317 
318 
319 
320 // we need the Epetra specialization only if Epetra is enabled
321 #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
322 
323 
324  template <>
325  class MapFactory<int, long long, EpetraNode>
326  {
327 
328  typedef int LocalOrdinal;
329  typedef long long GlobalOrdinal;
330  typedef EpetraNode Node;
331 
332  private:
333 
335  MapFactory();
336 
337  public:
338 
339 
340 
342  Build (UnderlyingLib lib,
343  global_size_t numGlobalElements,
344  int indexBase,
345  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
347 
348 
349 
350 
352  Build (UnderlyingLib lib,
353  global_size_t numGlobalElements,
354  size_t numLocalElements,
355  int indexBase,
356  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
357 
358 
359 
360 
362  Build(UnderlyingLib lib,
363  global_size_t numGlobalElements,
364  const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
365  int indexBase,
366  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
367 
368 
373  LocalOrdinal numDofPerNode);
374 
375 
378  size_t numElements,
379  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
380 
381 
382 
383 
386  size_t numElements,
387  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
388 
389 
390 
391 
394  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
395 
396 
399  global_size_t numElements,
400  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
401 
402 
405  global_size_t numElements,
406  size_t localNumElements,
407  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
408 
409 
410 
411 
414  global_size_t numElements,
415  size_t localNumElements,
416  const Teuchos::RCP< const Teuchos::Comm< int > > &comm);
417 
418  }; // class MapFactory<int, long long, EpetraNode> specialization
419 
420 
421 #endif // #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
422 
423 
424 #endif // #if defined(HAVE_XPETRA_EPETRA)
425 
426 
427 } // namespace Xpetra
428 
429 
430 #define XPETRA_MAPFACTORY_SHORT
431 
432 #endif // XPETRA_MAPFACTORY_DECL_HPP
433 
434 // TODO: removed unused methods
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node >> &map, const LocalOrdinal numDofPerNode, const GlobalOrdinal gidOffset=Teuchos::ScalarTraits< GlobalOrdinal >::zero())
Map constructor transforming degrees of freedom for numDofPerNode.
Create an Xpetra::Map instance.
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 > > createUniformContigMap(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a uniform, contiguous Map with the default node.
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 > > 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 > > 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.
Xpetra namespace
size_t global_size_t
Global size_t object.