MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::DebugOutput Class Reference

Utility class for printing debug output. More...

#include <DebugOutput.hpp>

+ Collaboration diagram for moab::DebugOutput:

Public Member Functions

 DebugOutput (DebugOutputStream *str, unsigned verbosity=0)
 DebugOutput (DebugOutputStream *str, int rank, unsigned verbosity=0)
 DebugOutput (FILE *str, unsigned verbosity=0)
 DebugOutput (FILE *str, int rank, unsigned verbosity=0)
 DebugOutput (std::ostream &str, unsigned verbosity=0)
 DebugOutput (std::ostream &str, int rank, unsigned verbosity=0)
 DebugOutput (const char *pfx, DebugOutputStream *str, unsigned verbosity=0)
 DebugOutput (const char *pfx, DebugOutputStream *str, int rank, unsigned verbosity=0)
 DebugOutput (const char *pfx, FILE *str, unsigned verbosity=0)
 DebugOutput (const char *pfx, FILE *str, int rank, unsigned verbosity=0)
 DebugOutput (const char *pfx, std::ostream &str, unsigned verbosity=0)
 DebugOutput (const char *pfx, std::ostream &str, int rank, unsigned verbosity=0)
 DebugOutput (const DebugOutput &copy)
DebugOutputoperator= (const DebugOutput &copy)
 ~DebugOutput ()
bool have_rank () const
 Check if MPI rank has been set.
int get_rank () const
 Get MPI rank.
void set_rank (int rank)
 Set MPI rank.
void use_world_rank ()
 Set MPI rank to the rank of this proccess in MPI_COMM_WORLD, or zero if MOAB is build w/out MPI.
void limit_output_to_first_N_procs (int N)
 Only print debug output from N processes.
unsigned get_verbosity () const
 Get verbosity limit.
void set_verbosity (unsigned val)
 Set verbosity limit.
const std::string & get_prefix () const
 Get line prefix.
void set_prefix (const std::string &str)
 Set line prefix.
void print (int verbosity, const char *str)
 Output the specified string iff output is enabled.
void print (int verbosity, const std::string &str)
 Output the specified string iff output is enabled.
void printf (int verbosity, const char *fmt,...) MB_PRINTF(2)
 Output the specified printf-formatted output iff output is enabled.
void tprint (int verbosity, const char *str)
 Output the specified string iff output is enabled.
void tprint (int verbosity, const std::string &str)
 Output the specified string iff output is enabled.
void tprintf (int verbosity, const char *fmt,...) MB_PRINTF(2)
 Output the specified printf-formatted output iff output is enabled.
void print (int verbosity, const char *pfx, const Range &range)
 Print the contents of a moab::Range.
void print (int verbosity, const Range &range)
 Print the contents of a moab::Range.
void print_ints (int verbosity, const char *pfx, const Range &range)
 Print the contents of a moab::Range as numerical values only.
void print_ints (int verbosity, const Range &range)
 Print the contents of a moab::Range as numerical values only.

Private Member Functions

void tprint ()
void list_range_real (const char *pfx, const Range &range)
void list_ints_real (const char *pfx, const Range &range)
void print_real (const char *buffer)
void print_real (const std::string &str)
void tprint_real (const char *buffer)
void tprint_real (const std::string &str)
void print_real (const char *buffer, va_list args1, va_list args2)
void tprint_real (const char *buffer, va_list args1, va_list args2)
void process_line_buffer ()
bool check (unsigned verbosity)

Private Attributes

std::string linePfx
DebugOutputStreamoutputImpl
int mpiRank
unsigned verbosityLimit
CpuTimer cpuTi
std::vector< char > lineBuffer

Detailed Description

Utility class for printing debug output.

This class implements line-oriented output. That is, it buffers output data until a newline is encountered, at which point it sends the output to the output stream followed by an explicit flush, and optionally prefixed with the MPI rank.

This class also implements a verbosity filter for all output. The class instance has a verbosity limit. Each request for output has an associated verbosity level. If the verbosity level for the output is is less greater than the limit then the output is discarded. By convetion a verbosity limit of zero should indicate no output. Therefore all requests for output should have an associated verbosity level greater than or equal to one.

Any output not terminated with an newline character or followed by later output containing a newline character will not be flushed until the destructor is invoked. C++-style IO (i.e. std::ostream) is not supported because it is necessarily inefficient for debug-type output. All formatting (e.g. converting arguments to strings, etc.) must be done even when output is disabled.

Definition at line 43 of file DebugOutput.hpp.


Constructor & Destructor Documentation

moab::DebugOutput::DebugOutput ( DebugOutputStream str,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
verbosityVerbosity limit.

Definition at line 62 of file DebugOutput.cpp.

References moab::DebugOutputStream::referenceCount.

    : outputImpl( impl ), mpiRank( -1 ), verbosityLimit( verbosity )
{
    impl->referenceCount++;
    assert( impl->referenceCount > 1 );
}
moab::DebugOutput::DebugOutput ( DebugOutputStream str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 68 of file DebugOutput.cpp.

References moab::DebugOutputStream::referenceCount.

    : outputImpl( impl ), mpiRank( rank ), verbosityLimit( verbosity )
{
    impl->referenceCount++;
    assert( impl->referenceCount > 1 );
}
moab::DebugOutput::DebugOutput ( FILE *  str,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
enabledEnable output: if not true, all output operations to nothing.

Definition at line 74 of file DebugOutput.cpp.

    : outputImpl( new FILEDebugStream( impl ) ), mpiRank( -1 ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( FILE *  str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 78 of file DebugOutput.cpp.

    : outputImpl( new FILEDebugStream( impl ) ), mpiRank( rank ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( std::ostream &  str,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
verbosityVerbosity limit.

Definition at line 82 of file DebugOutput.cpp.

    : outputImpl( new CxxDebugStream( str ) ), mpiRank( -1 ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( std::ostream &  str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 86 of file DebugOutput.cpp.

    : outputImpl( new CxxDebugStream( str ) ), mpiRank( rank ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
DebugOutputStream str,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
verbosityVerbosity limit.

Definition at line 90 of file DebugOutput.cpp.

References moab::DebugOutputStream::referenceCount.

    : linePfx( pfx ), outputImpl( impl ), mpiRank( -1 ), verbosityLimit( verbosity )
{
    impl->referenceCount++;
    assert( impl->referenceCount > 1 );
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
DebugOutputStream str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 96 of file DebugOutput.cpp.

References moab::DebugOutputStream::referenceCount.

    : linePfx( pfx ), outputImpl( impl ), mpiRank( rank ), verbosityLimit( verbosity )
{
    impl->referenceCount++;
    assert( impl->referenceCount > 1 );
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
FILE *  str,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
enabledEnable output: if not true, all output operations to nothing.

Definition at line 102 of file DebugOutput.cpp.

    : linePfx( pfx ), outputImpl( new FILEDebugStream( impl ) ), mpiRank( -1 ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
FILE *  str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 106 of file DebugOutput.cpp.

    : linePfx( pfx ), outputImpl( new FILEDebugStream( impl ) ), mpiRank( rank ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
std::ostream &  str,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
verbosityVerbosity limit.

Definition at line 110 of file DebugOutput.cpp.

    : linePfx( pfx ), outputImpl( new CxxDebugStream( str ) ), mpiRank( -1 ), verbosityLimit( verbosity )
{
}
moab::DebugOutput::DebugOutput ( const char *  pfx,
std::ostream &  str,
int  rank,
unsigned  verbosity = 0 
)
Parameters:
pfxPrefix for output
strOutput stream to which to flush output
rankMPI rank with which to prefix output.
verbosityVerbosity limit.

Definition at line 114 of file DebugOutput.cpp.

    : linePfx( pfx ), outputImpl( new CxxDebugStream( str ) ), mpiRank( rank ), verbosityLimit( verbosity )
{
}

Definition at line 119 of file DebugOutput.cpp.

References outputImpl, and moab::DebugOutputStream::referenceCount.

    : linePfx( copy.linePfx ), outputImpl( copy.outputImpl ), mpiRank( copy.mpiRank ),
      verbosityLimit( copy.verbosityLimit )
{
    outputImpl->referenceCount++;
    assert( outputImpl->referenceCount > 1 );
}

Destructor flushes any remaining output that wasn't followed by a newline character.

Definition at line 138 of file DebugOutput.cpp.

References lineBuffer, outputImpl, process_line_buffer(), and moab::DebugOutputStream::referenceCount.

{
    if( !lineBuffer.empty() )
    {
        lineBuffer.push_back( '\n' );
        process_line_buffer();
    }
    if( outputImpl )
    {
        assert( outputImpl->referenceCount > 0 );
        if( !--outputImpl->referenceCount ) delete outputImpl;
        outputImpl = 0;
    }
}

Member Function Documentation

bool moab::DebugOutput::check ( unsigned  verbosity) [inline, private]

Definition at line 263 of file DebugOutput.hpp.

References verbosityLimit.

Referenced by print(), print_ints(), printf(), tprint(), and tprintf().

    {
        return verbosity <= verbosityLimit;
    }
const std::string& moab::DebugOutput::get_prefix ( ) const [inline]

Get line prefix.

Definition at line 167 of file DebugOutput.hpp.

References linePfx.

    {
        return linePfx;
    }
int moab::DebugOutput::get_rank ( ) const [inline]

Get MPI rank.

Definition at line 136 of file DebugOutput.hpp.

References mpiRank.

Referenced by process_line_buffer().

    {
        return mpiRank;
    }
bool moab::DebugOutput::have_rank ( ) const [inline]

Check if MPI rank has been set.

Definition at line 131 of file DebugOutput.hpp.

References mpiRank.

Referenced by process_line_buffer().

    {
        return mpiRank >= 0;
    }

Only print debug output from N processes.

Definition at line 150 of file DebugOutput.hpp.

References mpiRank, and verbosityLimit.

Referenced by moab::WriteHDF5Parallel::parallel_create_file(), and moab::ReadHDF5::set_up_read().

    {
        if( mpiRank >= N ) verbosityLimit = 0;
    }
void moab::DebugOutput::list_ints_real ( const char *  pfx,
const Range range 
) [private]

Definition at line 309 of file DebugOutput.cpp.

References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::Range::empty(), lineBuffer, moab::print_range(), print_real(), and process_line_buffer().

Referenced by print_ints().

{
    if( range.empty() )
    {
        print_real( "<empty>\n" );
        return;
    }

    if( pfx )
    {
        lineBuffer.insert( lineBuffer.end(), pfx, pfx + strlen( pfx ) );
        lineBuffer.push_back( ' ' );
    }

    char numbuf[48];  // unsigned 64 bit integer can't have more than 20 decimal digits
    Range::const_pair_iterator i;
    for( i = range.const_pair_begin(); i != range.const_pair_end(); ++i )
    {
        if( i->first == i->second )
            sprintf( numbuf, " %lu,", (unsigned long)( i->first ) );
        else
            print_range( numbuf, (unsigned long)( i->first ), (unsigned long)( i->second ) );
        lineBuffer.insert( lineBuffer.end(), numbuf, numbuf + strlen( numbuf ) );
    }

    lineBuffer.push_back( '\n' );
    process_line_buffer();
}
void moab::DebugOutput::list_range_real ( const char *  pfx,
const Range range 
) [private]

Definition at line 273 of file DebugOutput.cpp.

References moab::Range::const_pair_begin(), moab::Range::const_pair_end(), moab::Range::empty(), moab::CN::EntityTypeName(), moab::ID_FROM_HANDLE(), lineBuffer, MBMAXTYPE, moab::print_range(), print_real(), process_line_buffer(), and moab::TYPE_FROM_HANDLE().

Referenced by print().

{
    if( pfx )
    {
        lineBuffer.insert( lineBuffer.end(), pfx, pfx + strlen( pfx ) );
        lineBuffer.push_back( ' ' );
    }

    if( range.empty() )
    {
        print_real( "<empty>\n" );
        return;
    }

    char numbuf[48];  // unsigned 64 bit integer can't have more than 20 decimal digits
    Range::const_pair_iterator i;
    EntityType type = MBMAXTYPE;
    for( i = range.const_pair_begin(); i != range.const_pair_end(); ++i )
    {
        if( TYPE_FROM_HANDLE( i->first ) != type )
        {
            type             = TYPE_FROM_HANDLE( i->first );
            const char* name = CN::EntityTypeName( type );
            lineBuffer.insert( lineBuffer.end(), name, name + strlen( name ) );
        }
        if( i->first == i->second )
            sprintf( numbuf, " %lu,", (unsigned long)( ID_FROM_HANDLE( i->first ) ) );
        else
            print_range( numbuf, ID_FROM_HANDLE( i->first ), ID_FROM_HANDLE( i->second ) );
        lineBuffer.insert( lineBuffer.end(), numbuf, numbuf + strlen( numbuf ) );
    }

    lineBuffer.push_back( '\n' );
    process_line_buffer();
}
DebugOutput & moab::DebugOutput::operator= ( const DebugOutput copy)

Definition at line 127 of file DebugOutput.cpp.

References linePfx, mpiRank, outputImpl, moab::DebugOutputStream::referenceCount, and verbosityLimit.

{
    linePfx        = copy.linePfx;
    outputImpl     = copy.outputImpl;
    mpiRank        = copy.mpiRank;
    verbosityLimit = copy.verbosityLimit;
    outputImpl->referenceCount++;
    assert( outputImpl->referenceCount > 1 );
    return *this;
}
void moab::DebugOutput::print ( int  verbosity,
const std::string &  str 
) [inline]

Output the specified string iff output is enabled.

Definition at line 184 of file DebugOutput.hpp.

References check(), and print_real().

    {
        if( check( verbosity ) ) print_real( str );
    }
void moab::DebugOutput::print ( int  verbosity,
const char *  pfx,
const Range range 
) [inline]

Print the contents of a moab::Range.

Parameters:
pfxString to print after default class prefix and before range contents

Definition at line 215 of file DebugOutput.hpp.

References check(), and list_range_real().

    {
        if( check( verbosity ) ) list_range_real( pfx, range );
    }
void moab::DebugOutput::print ( int  verbosity,
const Range range 
) [inline]

Print the contents of a moab::Range.

Definition at line 220 of file DebugOutput.hpp.

References check(), and list_range_real().

    {
        if( check( verbosity ) ) list_range_real( 0, range );
    }
void moab::DebugOutput::print_ints ( int  verbosity,
const char *  pfx,
const Range range 
) [inline]

Print the contents of a moab::Range as numerical values only.

Parameters:
pfxString to print after default class prefix and before range contents

Definition at line 227 of file DebugOutput.hpp.

References check(), and list_ints_real().

Referenced by moab::ReadHDF5::load_file_partial(), and moab::ReadHDF5::read_set_ids_recursive().

    {
        if( check( verbosity ) ) list_ints_real( pfx, range );
    }
void moab::DebugOutput::print_ints ( int  verbosity,
const Range range 
) [inline]

Print the contents of a moab::Range as numerical values only.

Definition at line 232 of file DebugOutput.hpp.

References check(), and list_ints_real().

    {
        if( check( verbosity ) ) list_ints_real( 0, range );
    }
void moab::DebugOutput::print_real ( const char *  buffer) [private]

Definition at line 162 of file DebugOutput.cpp.

References buffer, lineBuffer, and process_line_buffer().

Referenced by list_ints_real(), list_range_real(), print(), printf(), and tprint_real().

{
    lineBuffer.insert( lineBuffer.end(), buffer, buffer + strlen( buffer ) );
    process_line_buffer();
}
void moab::DebugOutput::print_real ( const std::string &  str) [private]

Definition at line 174 of file DebugOutput.cpp.

References lineBuffer, and process_line_buffer().

{
    lineBuffer.insert( lineBuffer.end(), str.begin(), str.end() );
    process_line_buffer();
}
void moab::DebugOutput::print_real ( const char *  buffer,
va_list  args1,
va_list  args2 
) [private]

Definition at line 186 of file DebugOutput.cpp.

References lineBuffer, process_line_buffer(), and size.

{
    size_t idx = lineBuffer.size();
#ifdef MOAB_HAVE_VSNPRINTF
    // try once with remaining space in buffer
    lineBuffer.resize( lineBuffer.capacity() );
    unsigned size = vsnprintf( &lineBuffer[idx], lineBuffer.size() - idx, fmt, args1 );
    ++size;  // trailing null
             // if necessary, increase buffer size and retry
    if( size > ( lineBuffer.size() - idx ) )
    {
        lineBuffer.resize( idx + size );
        size = vsnprintf( &lineBuffer[idx], lineBuffer.size() - idx, fmt, args2 );
        ++size;  // trailing null
    }
#else
    // Guess how much space might be required.
    // If every character is a format code then there are len/3 format codes.
    // Guess a random large value of num_chars characters per formatted argument.
    const unsigned num_chars = 180;
    unsigned exp_size        = ( num_chars / 3 ) * strlen( fmt );
    lineBuffer.resize( idx + exp_size );
    unsigned size = vsprintf( &lineBuffer[idx], fmt, args1 );
    ++size;  // trailing null
             // check if we overflowed the buffer
    if( size > exp_size )
    {
        // crap!
        fprintf( stderr, "ERROR: Buffer overflow at %s:%d\n", __FILE__, __LINE__ );
        lineBuffer.resize( idx + exp_size );
        size = vsprintf( &lineBuffer[idx], fmt, args2 );
        ++size;  // trailing null
    }
#endif

    // less one because we don't want the trailing '\0'
    lineBuffer.resize( idx + size - 1 );
    process_line_buffer();
}
void moab::DebugOutput::printf ( int  verbosity,
const char *  fmt,
  ... 
) [inline]

Output the specified printf-formatted output iff output is enabled.

Definition at line 282 of file DebugOutput.hpp.

References check(), and print_real().

Referenced by moab::WriteHDF5::assign_ids(), moab::WriteHDF5Parallel::communicate_shared_set_data(), moab::WriteHDF5Parallel::communicate_shared_set_ids(), moab::TempestRemapper::ComputeOverlapMesh(), moab::TempestRemapper::convert_tempest_mesh_private(), moab::TempestRemapper::ConvertMeshToTempest(), moab::WriteHDF5Parallel::create_meshset_tables(), moab::WriteHDF5Parallel::create_tag_tables(), CreateTempestMesh(), moab::WriteHDF5Parallel::debug_barrier_line(), moab::ReadHDF5::debug_barrier_line(), moab::ReadHDF5::delete_non_side_elements(), moab::WriteHDF5Parallel::exchange_file_ids(), moab::ReadHDF5::find_sets_containing(), moab::TempestOnlineMap::GenerateRemappingWeights(), moab::TempestOnlineMap::LinearRemapFVtoFV_Tempest_MOAB(), moab::TempestOnlineMap::LinearRemapGLLtoGLL2_MOAB(), moab::TempestOnlineMap::LinearRemapGLLtoGLL2_Pointwise_MOAB(), moab::TempestOnlineMap::LinearRemapSE4_Tempest_MOAB(), moab::ReadHDF5::load_file_partial(), main(), moab::WriteHDF5Parallel::negotiate_type_list(), moab::ParallelComm::print_debug_irecv(), moab::ParallelComm::print_debug_waitany(), moab::WriteHDF5Parallel::print_set_sharing_data(), moab::print_type_sets(), moab::ReadHDF5::read_adjacencies(), moab::ReadHDF5VarLen::read_data(), moab::ReadHDF5::read_dense_tag(), moab::ReadHDF5::read_elems(), moab::ReadHDF5::read_node_adj_elems(), moab::ReadHDF5::read_nodes(), moab::ReadHDF5VarLen::read_offsets(), moab::ScdNCHelper::read_scd_variables_to_nonset(), moab::ReadHDF5::read_set_data(), moab::ReadHDF5::read_sparse_tag(), moab::ReadHDF5::read_sparse_tag_indices(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_partial(), moab::NCHelperHOMME::read_ucd_variables_to_nonset(), moab::NCHelperGCRM::read_ucd_variables_to_nonset(), moab::NCHelperMPAS::read_ucd_variables_to_nonset(), moab::NCHelper::read_variables_to_set(), moab::ParallelComm::resolve_shared_ents(), moab::WriteHDF5::write_elems(), moab::WriteHDF5::write_nodes(), moab::WriteHDF5::write_sets(), and moab::WriteHDF5::write_tag().

{
    if( check( verbosity ) )
    {
        va_list args1, args2;
        va_start( args1, fmt );
        va_start( args2, fmt );
        print_real( fmt, args1, args2 );
        va_end( args2 );
        va_end( args1 );
    }
}

Definition at line 338 of file DebugOutput.cpp.

References get_rank(), have_rank(), lineBuffer, linePfx, outputImpl, and moab::DebugOutputStream::println().

Referenced by list_ints_real(), list_range_real(), print_real(), and ~DebugOutput().

{
    size_t last_idx = 0;
    std::vector< char >::iterator i;
    for( i = std::find( lineBuffer.begin(), lineBuffer.end(), '\n' ); i != lineBuffer.end();
         i = std::find( i, lineBuffer.end(), '\n' ) )
    {
        *i = '\0';
        if( have_rank() )
            outputImpl->println( get_rank(), linePfx.c_str(), &lineBuffer[last_idx] );
        else
            outputImpl->println( linePfx.c_str(), &lineBuffer[last_idx] );
        ++i;
        last_idx = i - lineBuffer.begin();
    }

    if( last_idx )
    {
        i = std::copy( lineBuffer.begin() + last_idx, lineBuffer.end(), lineBuffer.begin() );
        lineBuffer.erase( i, lineBuffer.end() );
    }
}
void moab::DebugOutput::tprint ( int  verbosity,
const std::string &  str 
) [inline]

Output the specified string iff output is enabled.

Include current CPU time (as returned by clock()) in output.

Definition at line 203 of file DebugOutput.hpp.

References check(), and tprint_real().

    {
        if( check( verbosity ) ) tprint_real( str );
    }
void moab::DebugOutput::tprint ( ) [private]

Definition at line 361 of file DebugOutput.cpp.

References cpuTi, lineBuffer, and moab::CpuTimer::time_since_birth().

Referenced by tprint_real().

{
    size_t s = lineBuffer.size();
    lineBuffer.resize( s + 64 );
    size_t ss = sprintf( &lineBuffer[s], "(%.2f s) ", cpuTi.time_since_birth() );
    lineBuffer.resize( s + ss );
}
void moab::DebugOutput::tprint_real ( const char *  buffer) [private]

Definition at line 168 of file DebugOutput.cpp.

References print_real(), and tprint().

Referenced by tprint(), and tprintf().

void moab::DebugOutput::tprint_real ( const std::string &  str) [private]

Definition at line 180 of file DebugOutput.cpp.

References print_real(), and tprint().

{
    tprint();
    print_real( str );
}
void moab::DebugOutput::tprint_real ( const char *  buffer,
va_list  args1,
va_list  args2 
) [private]

Definition at line 226 of file DebugOutput.cpp.

References print_real(), and tprint().

{
    tprint();
    print_real( fmt, args1, args2 );
}
void moab::DebugOutput::tprintf ( int  verbosity,
const char *  fmt,
  ... 
) [inline]

Output the specified printf-formatted output iff output is enabled.

Include current CPU time (as returned by clock()) in output.

Definition at line 295 of file DebugOutput.hpp.

References check(), and tprint_real().

Referenced by moab::NCWriteHelper::collect_variable_data(), moab::WriteHDF5Parallel::communicate_shared_set_data(), moab::NCHelper::create_conventional_tags(), moab::NCHelper::create_dummy_variables(), moab::NCHelperGCRM::create_local_edges(), moab::NCHelperMPAS::create_local_edges(), moab::NCHelperGCRM::create_local_vertices(), moab::NCHelperMPAS::create_local_vertices(), moab::NCHelperDomain::create_mesh(), moab::NCHelperScrip::create_mesh(), moab::NCHelperHOMME::create_mesh(), moab::NCHelperMPAS::create_mesh(), moab::NCHelperGCRM::create_mesh(), moab::ScdNCHelper::create_mesh(), moab::ParallelComm::exchange_ghost_cells(), moab::ParallelComm::exchange_owned_mesh(), moab::ParallelComm::exchange_tags(), moab::ReadNC::get_attributes(), moab::ReadNC::get_dimensions(), moab::NCHelper::get_tag_to_nonset(), moab::NCHelper::get_tag_to_set(), moab::ReadNC::get_variables(), moab::NCWriteHelper::init_file(), moab::NCHelperDomain::init_mesh_vals(), moab::NCHelperFV::init_mesh_vals(), moab::NCHelperEuler::init_mesh_vals(), moab::ReadParallel::load_file(), moab::ReadHDF5::load_file(), moab::ReadNC::load_file(), moab::ReadHDF5::load_file_partial(), moab::ParallelComm::pack_entities(), moab::ParallelComm::pack_entity_seq(), moab::ParallelComm::pack_sets(), moab::ParallelComm::pack_tag(), moab::ParallelComm::pack_tags(), moab::WriteHDF5Parallel::parallel_create_file(), moab::ParallelComm::print_debug_irecv(), moab::ParallelComm::print_debug_isend(), moab::ParallelComm::print_debug_recd(), moab::ParallelComm::print_debug_waitany(), moab::WriteNC::process_concatenated_attribute(), moab::WriteNC::process_conventional_tags(), moab::ReadHDF5::read_elems(), moab::ReadNC::read_header(), moab::ReadHDF5::read_nodes(), moab::ScdNCHelper::read_scd_variables_to_nonset(), moab::ScdNCHelper::read_scd_variables_to_nonset_allocate(), moab::ReadHDF5::read_set_ids_recursive(), moab::ReadHDF5::read_tag(), moab::NCHelperHOMME::read_ucd_variables_to_nonset(), moab::NCHelperMPAS::read_ucd_variables_to_nonset(), moab::NCHelperGCRM::read_ucd_variables_to_nonset(), moab::NCHelperHOMME::read_ucd_variables_to_nonset_allocate(), moab::NCHelperGCRM::read_ucd_variables_to_nonset_allocate(), moab::NCHelperMPAS::read_ucd_variables_to_nonset_allocate(), moab::NCHelper::read_variables_to_set(), moab::NCHelper::read_variables_to_set_allocate(), moab::ParallelComm::recv_entities(), moab::ParallelComm::reduce_tags(), moab::ParallelComm::resolve_shared_ents(), moab::ParallelComm::send_entities(), moab::ParallelComm::send_recv_entities(), moab::ReadHDF5::set_up_read(), moab::ParallelComm::settle_intersection_points(), moab::ParallelComm::unpack_buffer(), moab::ParallelComm::unpack_entities(), moab::ParallelComm::unpack_sets(), moab::ParallelComm::unpack_tags(), moab::WriteNC::write_file(), and moab::WriteHDF5::write_tag().

{
    if( check( verbosity ) )
    {
        va_list args1, args2;
        va_start( args1, fmt );
        va_start( args2, fmt );
        tprint_real( fmt, args1, args2 );
        va_end( args2 );
        va_end( args1 );
    }
}

Set MPI rank to the rank of this proccess in MPI_COMM_WORLD, or zero if MOAB is build w/out MPI.

Definition at line 153 of file DebugOutput.cpp.

References MPI_COMM_WORLD, and mpiRank.

{
    mpiRank = 0;
#ifdef MOAB_HAVE_MPI
    int flag = 0;
    if( MPI_SUCCESS == MPI_Initialized( &flag ) && flag ) MPI_Comm_rank( MPI_COMM_WORLD, &mpiRank );
#endif
}

Member Data Documentation

Definition at line 242 of file DebugOutput.hpp.

Referenced by tprint().

std::vector< char > moab::DebugOutput::lineBuffer [private]
std::string moab::DebugOutput::linePfx [private]

Definition at line 238 of file DebugOutput.hpp.

Referenced by get_prefix(), operator=(), process_line_buffer(), and set_prefix().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines