Tpetra Matrix/Vector Services Version of the Day
Namespaces | Defines | Functions
Tpetra_Util.hpp File Reference

Stand-alone utility functions. More...

#include "Tpetra_ConfigDefs.hpp"
#include <iterator>
#include <algorithm>
#include <Teuchos_Utils.hpp>
#include <Teuchos_Assert.hpp>
#include <sstream>

Go to the source code of this file.

Namespaces

namespace  Tpetra
 

Namespace Tpetra contains the class and methods constituting the Tpetra library.


namespace  SortDetails
 

Implementation details of sort routines used by Tpetra.


Defines

#define TPETRA_EFFICIENCY_WARNING(throw_exception_test, Exception, msg)
 Handle an efficiency warning, according to HAVE_TPETRA_THROW_EFFICIENCY_WARNINGS and HAVE_TPETRA_PRINT_EFFICIENCY_WARNINGS.
#define TPETRA_ABUSE_WARNING(throw_exception_test, Exception, msg)
 Handle an abuse warning, according to HAVE_TPETRA_THROW_ABUSE_WARNINGS and HAVE_TPETRA_PRINT_ABUSE_WARNINGS.
#define SHARED_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg, comm)
#define SWITCHED_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg, comm)
 If TEUCHOS_DEBUG is defined, then it calls SHARED_TEST_FOR_EXCEPTION. Otherwise, it calls TEUCHOS_TEST_FOR_EXCEPTION.

Functions

template<typename MapType , typename KeyArgType , typename ValueArgType >
MapType::iterator Tpetra::efficientAddOrUpdate (MapType &m, const KeyArgType &k, const ValueArgType &v)
template<class IT1 >
bool Tpetra::SortDetails::isAlreadySorted (const IT1 &first, const IT1 &last)
 Determines whether or not a random access sequence is already sorted.
template<class IT >
IT Tpetra::SortDetails::getPivot (const IT &first, const IT &last)
 Determines the pivot point as part of the quicksort routine.
template<class IT1 , class IT2 >
IT1 Tpetra::SortDetails::partition2 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT2 &last2, const IT1 &pivot)
 Partition operation for quicksort2().
template<class IT1 , class IT2 , class IT3 >
IT1 Tpetra::SortDetails::partition3 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT2 &last2, const IT3 &first3, const IT3 &last3, const IT1 &pivot)
 Partition operation for quicksort3().
template<class IT1 , class IT2 >
void Tpetra::SortDetails::quicksort2 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT2 &last2)
 Sort the first array using Quicksort, and apply the resulting permutation to the second array.
template<class IT1 , class IT2 , class IT3 >
void Tpetra::SortDetails::quicksort3 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT2 &last2, const IT3 &first3, const IT3 &last3)
 Sort the first array using Quicksort, and apply the resulting permutation to the second and third arrays.
template<class IT1 , class IT2 >
void Tpetra::sort2 (const IT1 &first1, const IT1 &last1, const IT2 &first2)
 Sort the first array, and apply the resulting permutation to the second array.
template<class IT1 , class IT2 , class IT3 >
void Tpetra::sort3 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT3 &first3)
 Sort the first array, and apply the same permutation to the second and third arrays.

Detailed Description

Stand-alone utility functions.

Tpetra_Util contains utility functions that are used throughout Tpetra, by many classes and functions. They are placed here so that they can be updated and maintained in a single spot.

Utility functions housed here:

Definition in file Tpetra_Util.hpp.


Define Documentation

#define TPETRA_EFFICIENCY_WARNING (   throw_exception_test,
  Exception,
  msg 
)

Handle an efficiency warning, according to HAVE_TPETRA_THROW_EFFICIENCY_WARNINGS and HAVE_TPETRA_PRINT_EFFICIENCY_WARNINGS.

Definition at line 66 of file Tpetra_Util.hpp.

#define TPETRA_ABUSE_WARNING (   throw_exception_test,
  Exception,
  msg 
)

Handle an abuse warning, according to HAVE_TPETRA_THROW_ABUSE_WARNINGS and HAVE_TPETRA_PRINT_ABUSE_WARNINGS.

Definition at line 84 of file Tpetra_Util.hpp.

#define SHARED_TEST_FOR_EXCEPTION (   throw_exception_test,
  Exception,
  msg,
  comm 
)
Value:
{ \
    using Teuchos::outArg; \
    const int lcl_throw_exception = (throw_exception_test) ? Teuchos::rank(comm)+1 : 0; \
    int gbl_throw; \
    Teuchos::reduceAll(comm,Teuchos::REDUCE_MAX,lcl_throw_exception,outArg(gbl_throw)); \
    TEUCHOS_TEST_FOR_EXCEPTION(gbl_throw,Exception,  \
                       msg << " Failure on node " << gbl_throw-1 << "." << std::endl); \
}

Shared test for exception Just like Teuchos TEUCHOS_TEST_FOR_EXCEPTION, but with the assurance that all nodes test and throw the exception together.

Definition at line 91 of file Tpetra_Util.hpp.

#define SWITCHED_TEST_FOR_EXCEPTION (   throw_exception_test,
  Exception,
  msg,
  comm 
)
Value:
{ \
    TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test,Exception,msg); \
}

If TEUCHOS_DEBUG is defined, then it calls SHARED_TEST_FOR_EXCEPTION. Otherwise, it calls TEUCHOS_TEST_FOR_EXCEPTION.

Definition at line 109 of file Tpetra_Util.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines