Skip to content

Commit

Permalink
Tpetra: Make Map "ProblematicLookup" test not depend on GO=int
Browse files Browse the repository at this point in the history
@trilinos/tpetra Tpetra::Map's "ProblematicLookup" test depended
arbitrarily on LocalOrdinal=int and GlobalOrdinal=int.  This commit
changes the test to use the default LocalOrdinal and GlobalOrdinal
types.  See trilinos#74.
  • Loading branch information
Mark Hoemmen committed Aug 7, 2017
1 parent aed48c6 commit aefb733
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
3 changes: 1 addition & 2 deletions packages/tpetra/core/test/Map/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IF (Tpetra_INST_INT_INT)

TRIBITS_ADD_EXECUTABLE_AND_TEST(
Map_ProblematicLookup
SOURCES
Expand All @@ -8,7 +8,6 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
NUM_MPI_PROCS 2
STANDARD_PASS_OUTPUT
)
ENDIF()

# tjf 20 Oct 2016 modified to use default LO, GO types
TRIBITS_ADD_EXECUTABLE_AND_TEST(
Expand Down
34 changes: 17 additions & 17 deletions packages/tpetra/core/test/Map/Map_ProblematicLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@
// @HEADER
*/

#include <Tpetra_ConfigDefs.hpp>

#ifdef HAVE_TPETRA_INST_INT_INT

#include <Teuchos_UnitTestHarness.hpp>
#include <Teuchos_Tuple.hpp>
#include <Tpetra_DefaultPlatform.hpp>
#include <Tpetra_Map.hpp>
#include "Teuchos_UnitTestHarness.hpp"
#include "Teuchos_Tuple.hpp"
#include "Tpetra_DefaultPlatform.hpp"
#include "Tpetra_Map.hpp"

using Teuchos::RCP;
using Teuchos::Array;
Expand Down Expand Up @@ -78,14 +74,19 @@ TEUCHOS_UNIT_TEST( Map, ProblematicLookup )
comm->barrier ();
comm->barrier (); // Just to make sure output finishes.

RCP<const Tpetra::Map<int,int> > map;
typedef Tpetra::Map<> map_type;
typedef map_type::local_ordinal_type LO;
typedef map_type::global_ordinal_type GO;
typedef int rank_type;

RCP<const map_type> map;
if (myRank == 0) {
Array<int> gids( tuple<int>(1) );
map = Tpetra::createNonContigMap<int>( gids().getConst() , comm );
Array<GO> gids (tuple<GO> (1));
map = Tpetra::createNonContigMap<LO, GO> (gids ().getConst () , comm);
}
else {
Array<int> gids( tuple<int>(3) );
map = Tpetra::createNonContigMap<int>( gids().getConst() , comm );
Array<GO> gids (tuple<GO> (3));
map = Tpetra::createNonContigMap<LO, GO> (gids ().getConst (), comm);
}

{
Expand All @@ -100,8 +101,8 @@ TEUCHOS_UNIT_TEST( Map, ProblematicLookup )
cerr << os.str ();
}

Array<int> nodeIDs( 1 );
Tpetra::LookupStatus lookup = map->getRemoteIndexList( tuple<int>(2), nodeIDs() );
Array<rank_type> processRanks (1);
Tpetra::LookupStatus lookup = map->getRemoteIndexList (tuple<GO> (2), processRanks ());

{
std::ostringstream os;
Expand All @@ -117,7 +118,6 @@ TEUCHOS_UNIT_TEST( Map, ProblematicLookup )
TEST_EQUALITY_CONST( map->isDistributed(), true )
TEST_EQUALITY_CONST( map->isContiguous(), false )
TEST_EQUALITY_CONST( lookup, Tpetra::IDNotPresent )
TEST_COMPARE_ARRAYS( nodeIDs(), tuple<int>(-1) );
TEST_COMPARE_ARRAYS( processRanks(), tuple<rank_type>(-1) );
}

#endif // HAVE_TPETRA_INST_INT_INT

0 comments on commit aefb733

Please sign in to comment.