openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Classes | Namespaces | Macros | Typedefs | Functions
basics.h File Reference

Basic utility structs and functions, mostly IO related. More...

#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <cstring>
#include <cassert>
#include <string>
#include <unistd.h>
#include <sys/stat.h>
#include <mpi.h>
#include <petscsys.h>
#include "vect.h"
#include "SF_vector.h"
#include "openCARP_p.h"
#include "openCARP_d.h"
Include dependency graph for basics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  opencarp::Salt_list
 saltatory list – memory is allocated in chunks More...
 
struct  opencarp::file_desc
 File descriptor struct. More...
 
class  opencarp::geom_shape
 class to store shape definitions More...
 

Namespaces

 opencarp
 

Macros

#define CARP_PARAMS
 
#define STRUCT_ZERO(S)   memset(&(S), 0, sizeof(S))
 
#define SLIST_APPEND(S, P)   sltlst_append( S, &(P), sizeof(P) )
 
#define ECHO   1
 
#define LOCAL   2
 
#define SYNCED   4
 
#define FLUSH   8
 
#define NONL   16
 
#define MAX_MESG_LEN   2048
 
#define MAX_LOG_LEVEL   5
 
#define fmemopen_   fmemopen
 
#define OPENCARP_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(_macro)   template _macro(std::int32_t, double)
 

Typedefs

typedef file_desc * opencarp::FILE_SPEC
 

Functions

void opencarp::sltlst_append (Salt_list *sl, void *p, int quantum)
 
char * opencarp::dupstr (const char *old_str)
 
char * opencarp::stringify (double r)
 
std::string opencarp::get_basename (const std::string &path)
 
template<class STRVEC >
void opencarp::split_string (const std::string &input, const char s, STRVEC &list)
 Split a string holding a character-seperated list into a vector of strings. More...
 
bool opencarp::f_exist (const char *fname)
 
FILE_SPEC opencarp::f_open (const char *fname, const char *mode)
 Open a FILE_SPEC. More...
 
void opencarp::f_close (FILE_SPEC &f)
 Close a FILE_SPEC. More...
 
void opencarp::f_read_par (void *ptr, size_t size, size_t nmemb, FILE_SPEC stream, MPI_Comm comm=PETSC_COMM_WORLD)
 Parallel fread. Root reads, then broadcasts. More...
 
void opencarp::f_write_par (void *ptr, size_t size, size_t nmemb, int source_pid, FILE_SPEC stream, MPI_Comm comm=PETSC_COMM_WORLD)
 Write in parallel. Data comes from one rank, rank 0 writes. More...
 
char * opencarp::read_bin_string (FILE_SPEC in)
 
char * opencarp::read_bin_string_par (FILE_SPEC in)
 
char * opencarp::f_gets_par (char *s, int size, FILE_SPEC stream, MPI_Comm comm)
 
void opencarp::write_bin_string (FILE_SPEC out, const char *s)
 
template<typename T >
opencarp::get_global (T in, MPI_Op OP, MPI_Comm comm=PETSC_COMM_WORLD)
 Do a global reduction on a variable. More...
 
template<>
int opencarp::get_global< int > (int in, MPI_Op OP, MPI_Comm comm)
 
template<>
long int opencarp::get_global< long int > (long int in, MPI_Op OP, MPI_Comm comm)
 
template<typename T >
void opencarp::get_global (SF::vector< T > &vec, int sender=0, MPI_Comm comm=PETSC_COMM_WORLD)
 Broadcast a SF::vector to all processes. More...
 
int opencarp::get_rank (MPI_Comm comm=PETSC_COMM_WORLD)
 
int opencarp::get_size (MPI_Comm comm=PETSC_COMM_WORLD)
 
int opencarp::get_remote_size (MPI_Comm intercomm)
 
void opencarp::log_msg (FILE_SPEC out, int level, unsigned char flag, const char *fmt,...)
 
void opencarp::init_iterations_logger (FILE_SPEC *&logger, const char *filename)
 init a logger for solver iterations More...
 
void opencarp::remove_preceding_char (char *buff, const int buffsize, const char c)
 
void opencarp::remove_char (char *buff, const int buffsize, const char c)
 
bool opencarp::has_char (char *buff, const int buffsize, const char c)
 
bool opencarp::point_in_shape (const Point &p, const geom_shape &shape)
 test if a point is inside a simple geometric shape More...
 
bool opencarp::is_big_endian ()
 
bool opencarp::file_can_be_opened (const char *file)
 Check wheterh a file can be opened for reading. More...
 
bool opencarp::path_is_absolute (const char *path)
 check whether path is absolute More...
 
void opencarp::get_time (double &tm)
 
double opencarp::get_time ()
 
template<typename V >
opencarp::timing (V &t2, const V &t1)
 

Detailed Description

Basic utility structs and functions, mostly IO related.

Author
Aurel Neic, Edward Vigmond, Gernot Plank
Version
Date
2019-10-25

Definition in file basics.h.

Macro Definition Documentation

◆ CARP_PARAMS

#define CARP_PARAMS

Definition at line 46 of file basics.h.

◆ ECHO

#define ECHO   1

Definition at line 308 of file basics.h.

◆ FLUSH

#define FLUSH   8

Definition at line 311 of file basics.h.

◆ fmemopen_

#define fmemopen_   fmemopen

Definition at line 433 of file basics.h.

◆ LOCAL

#define LOCAL   2

Definition at line 309 of file basics.h.

◆ MAX_LOG_LEVEL

#define MAX_LOG_LEVEL   5

Definition at line 315 of file basics.h.

◆ MAX_MESG_LEN

#define MAX_MESG_LEN   2048

Definition at line 314 of file basics.h.

◆ NONL

#define NONL   16

Definition at line 312 of file basics.h.

◆ OPENCARP_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE

#define OPENCARP_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE (   _macro)    template _macro(std::int32_t, double)

Definition at line 458 of file basics.h.

◆ SLIST_APPEND

#define SLIST_APPEND (   S,
 
)    sltlst_append( S, &(P), sizeof(P) )

Definition at line 52 of file basics.h.

◆ STRUCT_ZERO

#define STRUCT_ZERO (   S)    memset(&(S), 0, sizeof(S))

Definition at line 51 of file basics.h.

◆ SYNCED

#define SYNCED   4

Definition at line 310 of file basics.h.