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_TestForException.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.


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 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 data structure 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)
 Preforms the partition operation that is part of the quicksort routine for two arrays.
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)
 Preforms the partition operation that is part of the quicksort routine for three arrays.
template<class IT1 , class IT2 >
void Tpetra::SortDetails::quicksort2 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT2 &last2)
 Prefoms a quick sort on the two arrays using the permutations that are done on the first array on the second array as well.
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)
 Prefoms a quick sort on the three arrays using the permutations that are done on the first array on the second and third arrays as well.
template<class IT1 , class IT2 >
void Tpetra::sort2 (const IT1 &first1, const IT1 &last1, const IT2 &first2)
 Sort function for two arrays.
template<class IT1 , class IT2 , class IT3 >
void Tpetra::sort3 (const IT1 &first1, const IT1 &last1, const IT2 &first2, const IT3 &first3)
 Sort function for three arrays.
template<class IT1 , class T >
IT1 Tpetra::binary_serach (IT1 first, IT1 last, const T &value)
 Preforms a binary search.

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 53 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 71 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)); \
    TEST_FOR_EXCEPTION(gbl_throw,Exception,  \
                       msg << " Failure on node " << gbl_throw-1 << "." << std::endl); \
}

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

Definition at line 78 of file Tpetra_Util.hpp.

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

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

Definition at line 96 of file Tpetra_Util.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines