Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Zoltan2_MeshCoordinateTest.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 //
11 // Zoltan2_MeshCoordinateTest.h
12 // Zoltan2TestDriver
13 //
14 // Created by Bradley Davidson on 7/6/15.
15 // Copyright (c) 2015 TXCorp. All rights reserved.
16 //
17 
18 #ifndef Zoltan2TestDriver_Zoltan2_MeshCoordinateTest_h
19 #define Zoltan2TestDriver_Zoltan2_MeshCoordinateTest_h
20 
26 
27 using Teuchos::RCP;
28 using Teuchos::rcp;
29 
30 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t> tMVector_t;
32 
33 
35 
36 public:
40 
44 
49  void Run(const ParameterList &params,const RCP<const Teuchos::Comm<int> > & comm);
50 
53  bool didPass();
54 
55 private:
56  bool success;
57 };
58 
59 
61  this->success = false;
62 };
63 
64 void MeshCoordinateTest::Run(const ParameterList &params,
65  const RCP<const Teuchos::Comm<int> > & comm)
66 {
67  const ParameterList &input = params.sublist("TestParameters");
68 
69  UserInputForTests uinput(input,comm,true, true);
70  if(!uinput.hasUICoordinates()) return;
71 
72  RCP<tMVector_t> coords = uinput.getUICoordinates();
73 
74  size_t localCount = coords->getLocalLength();
75 
76  zscalar_t *x=NULL, *y=NULL, *z=NULL;
77  x = coords->getDataNonConst(0).getRawPtr();
78  y = coords->getDataNonConst(1).getRawPtr();
79  z = coords->getDataNonConst(2).getRawPtr();
80 
81  const zgno_t *globalIds = coords->getMap()->getLocalElementList().getRawPtr();
82  typedef Zoltan2::BasicVectorAdapter<tMVector_t> inputAdapter_t;
83 
84  inputAdapter_t ia(localCount, globalIds, x, y, z, 1, 1, 1);
85 
86 // ParameterList zoltan2params(params.sublist("Zoltan2Parameters"));
87  const ParameterList &zoltan2params = params.sublist("Zoltan2Parameters");
88 #ifdef HAVE_ZOLTAN2_MPI
89  Zoltan2::PartitioningProblem<inputAdapter_t> problem(&ia, const_cast<ParameterList *>(&zoltan2params), MPI_COMM_WORLD);
90 #else
91  Zoltan2::PartitioningProblem<inputAdapter_t> problem(&ia, const_cast<ParameterList *>(&zoltan2params));
92 #endif
93 
94  problem.solve();
95 
96  this->success = true;
97 
98 }
99 
100 bool MeshCoordinateTest::didPass(){return this->success;}
101 
102 
103 #endif
void Run(const ParameterList &params, const RCP< const Teuchos::Comm< int > > &comm)
Defines the PartitioningSolution class.
MeshCoordinateTest()
Default Constructor.
Defines the XpetraMultiVectorAdapter.
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > myTypes_t
BasicVectorAdapter represents a vector (plus optional weights) supplied by the user as pointers to st...
PartitioningProblem sets up partitioning problems for the user.
RCP< tMVector_t > getUICoordinates()
Defines the PartitioningProblem class.
float zscalar_t
Defines the BasicVectorAdapter class.
Tpetra::MultiVector< zscalar_t, zlno_t, zgno_t, znode_t > tMVector_t
Tpetra::Map::global_ordinal_type zgno_t
void solve(bool updateInputData=true)
Direct the problem to create a solution.