38 #include "materials.hh"
52 Mesh* mesh = (
Mesh*) ConstantDB::getInstance()->getObject(MESH::MAIN_INSTANCE);
96 rct->type = atoi(
xstrtok( line) );
100 xprintf(
UsrErr,
"Unsupported reaction type #%d.\n", rct->type);
102 rct->sbi = atoi(
xstrtok( NULL) );
103 INPUT_CHECK(!(rct->sbi > transport->n_subst_ - 1),
"Unknown substance ID#%d.\n", rct->sbi);
105 rct->coef = (
double*)
xmalloc(pc *
sizeof(
double));
106 for(ci = 0 ; ci < pc ; ci++)
107 rct->coef[ci] = atof(
xstrtok( NULL) );
151 Mesh* mesh = (
Mesh*) ConstantDB::getInstance()->getObject(MESH::MAIN_INSTANCE);
158 ASSERT(!( mesh == NULL ),
"NULL as argument of function read_reaction_list()\n");
160 in =
xfopen( ConstantDB::getInstance()->getChar(
"Material_fname"),
"rt" );
161 found=skip_to( in,
"$Reactions" );
162 ASSERT( found ,
"Can not find section: $Reactions." );
164 sscanf( line,
"%s",
string );
167 while ((strcmp(
string,
"$EndReactions")) != 0){
170 sscanf( line,
"%s",
string );
173 transport->n_reaction = r;
174 ASSERT(!( r == 0 ),
"No reaction haven't defined\n");
175 transport->reaction =(
struct Reaction*)
xmalloc(transport->n_reaction *
sizeof(
struct Reaction));
178 in =
xfopen( ConstantDB::getInstance()->getChar(
"Material_fname"),
"rt" );
179 skip_to( in,
"$Reactions" );
180 for(i=0;i<transport->n_reaction;i++){
void read_reaction_list(struct Transport *transport)
READ REACTIONS LIST FROM *.MTR FILE.
void transport_reaction(double time_step, double ***conc, double ***pconc, int elm_pos, MaterialDatabase::Iter mtr, int sbi)
MAIN REACTION COMPUTATION (zero order)
int xfclose(FILE *stream)
FCLOSE WITH ERROR HANDLING.
oReaction * parse_reaction_line(int i, char *line)
PARSE REACTION LINE.
char * xfgets(char *s, int n, FILE *in)
FGETS WITH ERROR HANDLING and line count.
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
int reaction_type_specific_coefficients(int st)
REACTION TYPE SPECIFIC COEFFICIENTS.
void * xmalloc(size_t size)
Memory allocation with checking.
#define INPUT_CHECK(i,...)
Debugging macros.
char * xstrtok(char *s, int position)
STRTOK WITH ERROR HANDLING and whitespace delimiters.
char supported_reaction_type(int st)
SUPPORTED REACTION TYPE.
STRUCTURE OF THE REACTION (ONE SPECIE)
FILE * xfopen(const std::string &fname, const char *mode)