/var/www2/hermes2d/hermes2d/src/common.h File Reference

#include "config.h"
#include <stdexcept>
#include <cstdarg>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <math.h>
#include <time.h>
#include <float.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <fstream>
#include "compat.h"
#include <Judy.h>
#include "auto_local_array.h"
#include "common_time_period.h"

Go to the source code of this file.

Classes

struct  Hermes2DLogEventInfo
 Info about a log record. Used for output log function. More...

Defines

#define H2D_SECOND_DERIVATIVES_ENABLED
#define H2D_NUM_MODES   2
 A number of modes, see enum ElementMode.
#define H2D_MAKE_QUAD_ORDER(h_order, v_order)   (((v_order) << H2D_ORDER_BITS) + (h_order))
#define H2D_GET_H_ORDER(order)   ((order) & H2D_ORDER_MASK)
#define H2D_GET_V_ORDER(order)   ((order) >> H2D_ORDER_BITS)
#define H2D_IS_INT(x)   ((int) (x) == (x))
#define H2D_BUILD_LOG_INFO(__event)   Hermes2DLogEventInfo(__event, H2D_LOG_FILE, __CURRENT_FUNCTION, __FILE__, __LINE__)
 Builds info about an event.
#define H2D_LOG_FILE   "hermes2d.log"
#define __CURRENT_FUNCTION   __PRETTY_FUNCTION__
 A platform-dependent string defining a current function.
#define H2D_EC_ERROR   'E'
 An event code: errors.
#define H2D_EC_ASSERT   'X'
 An event code: asserts.
#define H2D_EC_WARNING   'W'
 An event code: warnings.
#define H2D_EC_INFO   'I'
 An event code: info about results.
#define H2D_EC_VERBOSE   'V'
 An event code: more details about details.
#define H2D_EC_TRACE   'R'
 An event code: execution tracing.
#define H2D_EC_TIME   'T'
 An event code: time measurements.
#define H2D_EC_DEBUG   'D'
 An event code: general debugging messages.
#define error(...)   hermes2d_exit_if(hermes2d_log_message_if(true, H2D_BUILD_LOG_INFO(H2D_EC_ERROR), __VA_ARGS__))
 Logs an error and quits the application. For details see Usage Guidelines.
#define error_if(__cond,...)   hermes2d_exit_if(hermes2d_log_message_if(__cond, H2D_BUILD_LOG_INFO(H2D_EC_ERROR), __VA_ARGS__))
 If __cond is true, it logs an error and quits the application.
#define assert_msg(__cond,...)   assert(!hermes2d_log_message_if(!(__cond), H2D_BUILD_LOG_INFO(H2D_EC_ASSERT), __VA_ARGS__))
 If __cond is false, it logs a message and invokes assert().
#define H2D_RCTR(__var)   true
 Defines a condition that can control whether logging of a given event is enabled.
#define warn(...)
 Logs a warning.
#define warn_if(__cond,...)
 If __cond is true, it logs a warning.
#define warn_intr(...)
 Logs an warning about integration. This is used to report integration issues which may occur frequently.
#define info(...)
 Logs info about a result of an operation.
#define info_if(__cond,...)
 If __cond is true, it logs info about a result of na operation.
#define verbose(...)
 Logs detailed info about a result of an operation. It should be used as a second level of the macro info().
#define trace(...)
 Logs information about executed code portions.
#define report_time(...)
 Logs information about measured time.
#define debug_log(...)   hermes2d_log_message_if(true && H2D_RCTR(__h2d_report_debug), H2D_BUILD_LOG_INFO(H2D_EC_DEBUG), __VA_ARGS__)
 Logs a general debugging information.
#define hermes2d_fwrite(ptr, size, nitems, stream)   __hermes2d_fwrite((ptr), (size), (nitems), (stream), H2D_BUILD_LOG_INFO(H2D_EC_ERROR))
#define hermes2d_fread(ptr, size, nitems, stream)   __hermes2d_fread((ptr), (size), (nitems), (stream), H2D_BUILD_LOG_INFO(H2D_EC_ERROR))

Typedefs

typedef double scalar
typedef int int2 [2]
typedef int int3 [3]
typedef int int4 [4]
typedef int int5 [5]
typedef double double2 [2]
typedef double double3 [3]
typedef double double4 [4]
typedef double double2x2 [2][2]
typedef double double3x2 [3][2]
typedef scalar scalar2 [2]
typedef scalar scalar3 [3]

Enumerations

enum  { H2D_TYPE_VERTEX = 0, H2D_TYPE_EDGE = 1 }
enum  ElementMode { H2D_MODE_TRIANGLE = 0, H2D_MODE_QUAD = 1 }

Functions

H2D_API const std::string get_quad_order_str (const int quad_order)
 Returns string representation of the quad order: used for debugging purposses.
int sqr (int x)
double sqr (double x)
double magn (double x)
double conj (double a)
H2D_API void hermes2d_exit_if (bool cond, int code=-1)
 Exits the application if the condition is true.
H2D_API bool hermes2d_log_message_if (bool cond, const Hermes2DLogEventInfo &info, const char *msg,...)
 Logs an event if the condition is true.
void __hermes2d_fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream, const Hermes2DLogEventInfo &err_info)
void __hermes2d_fread (void *ptr, size_t size, size_t nitems, FILE *stream, const Hermes2DLogEventInfo &err_info)
H2D_API void throw_exception (char *text)
 Throws an exception std::runtime_error. Used by Python wrappers.

Variables

const int H2D_ANY = -1234
const int H2D_ORDER_BITS = 5
const int H2D_ORDER_MASK = (1 << H2D_ORDER_BITS) - 1

Define Documentation

#define H2D_GET_H_ORDER ( order   )     ((order) & H2D_ORDER_MASK)
#define H2D_GET_V_ORDER ( order   )     ((order) >> H2D_ORDER_BITS)
#define H2D_IS_INT (  )     ((int) (x) == (x))
#define H2D_MAKE_QUAD_ORDER ( h_order,
v_order   )     (((v_order) << H2D_ORDER_BITS) + (h_order))
#define H2D_NUM_MODES   2

A number of modes, see enum ElementMode.

#define H2D_SECOND_DERIVATIVES_ENABLED
#define hermes2d_fread ( ptr,
size,
nitems,
stream   )     __hermes2d_fread((ptr), (size), (nitems), (stream), H2D_BUILD_LOG_INFO(H2D_EC_ERROR))
#define hermes2d_fwrite ( ptr,
size,
nitems,
stream   )     __hermes2d_fwrite((ptr), (size), (nitems), (stream), H2D_BUILD_LOG_INFO(H2D_EC_ERROR))

Typedef Documentation

typedef double double2[2]
typedef double double2x2[2][2]
typedef double double3[3]
typedef double double3x2[3][2]
typedef double double4[4]
typedef int int2[2]
typedef int int3[3]
typedef int int4[4]
typedef int int5[5]
typedef double scalar
typedef scalar scalar2[2]
typedef scalar scalar3[3]

Enumeration Type Documentation

anonymous enum
Enumerator:
H2D_TYPE_VERTEX 
H2D_TYPE_EDGE 
Enumerator:
H2D_MODE_TRIANGLE 
H2D_MODE_QUAD 

Function Documentation

void __hermes2d_fread ( void *  ptr,
size_t  size,
size_t  nitems,
FILE *  stream,
const Hermes2DLogEventInfo err_info 
)
void __hermes2d_fwrite ( const void *  ptr,
size_t  size,
size_t  nitems,
FILE *  stream,
const Hermes2DLogEventInfo err_info 
)
double conj ( double  a  )  [inline]
H2D_API const std::string get_quad_order_str ( const int  quad_order  ) 

Returns string representation of the quad order: used for debugging purposses.

double magn ( double  x  )  [inline]
double sqr ( double  x  )  [inline]
int sqr ( int  x  )  [inline]
H2D_API void throw_exception ( char *  text  ) 

Throws an exception std::runtime_error. Used by Python wrappers.

Parameters:
[in] text A text (a cause) of the exception.

Variable Documentation

const int H2D_ANY = -1234
const int H2D_ORDER_BITS = 5
const int H2D_ORDER_MASK = (1 << H2D_ORDER_BITS) - 1
Generated on Sat Jun 5 15:17:43 2010 for Hermes2D Library: Real Version by  doxygen 1.6.3