// atomic operations Nfa* AtomicMakeNfaBySingleC( Context* con, const char c ) { AddSymbol( con, c ); Nfa* ret = AddNfa( con ); Node* start = AddNode( con ); State* ss = MakeState( con ); AddState( start, ss); Node* end = AddNode( con ); ss = MakeState( con ); AddState( end, ss); AddEdge( start, end, c ); ret->starts = start; ret->accepts = end; return ret; }
Nfa* AtomicClosureNfa( Context* con, Nfa* in ) { Node* n1 = AddNode( con ); AddState( n1, MakeState( con ) ); AddEdge( n1, in->starts, EPSILON ); Node* n2 = AddNode( con ); AddState( n2, MakeState( con ) ); AddEdge( in->accepts, n2, EPSILON ); AddEdge( in->accepts, in->starts, EPSILON ); AddEdge( n1, n2, EPSILON ); in->starts = n1; in->accepts = n2; return in; }
/* *************************************************************** */ void ComputeUserVar (const Data *d, Grid *grid) /* * * PURPOSE * * Define user-defined output variables * * * ***************************************************************** */ { int i, j, k, nv; double inv_dl2; double *inv_dl; double ***Ch_dt, ***Cp_dt; static double *cmax, **dcoeff; static double ***T; static State_1D state; Index indx; if (state.rhs == NULL) { MakeState(&state); cmax = ARRAY_1D(NMAX_POINT, double); dcoeff = ARRAY_2D(NMAX_POINT, NVAR, double); T = ARRAY_3D(NX3_TOT, NX2_TOT, NX1_TOT, double); }
Nfa* AtomicOrNfa( Context* con, Nfa* first, Nfa* second ) { Node* n1 = AddNode( con ); AddState( n1, MakeState( con ) ); AddEdge( n1, first->starts, EPSILON ); AddEdge( n1, second->starts, EPSILON ); Node* n2 = AddNode( con ); AddState( n2, MakeState( con ) ); AddEdge( first->accepts, n2, EPSILON ); AddEdge( second->accepts, n2, EPSILON ); Nfa* nfa = AddNfa( con ); nfa->starts = n1; nfa->accepts = n2; RemoveNfa( con, first ); RemoveNfa( con, second ); return nfa; }
/* ********************************************************************* */ int Unsplit (const Data *d, Riemann_Solver *Riemann, Time_Step *Dts, Grid *grid) /*! * Advance the equations by a single time step using unsplit * integrators based on the method of lines. * * \param [in,out] d pointer to Data structure * \param [in] Riemann pointer to a Riemann solver function * \param [in,out] Dts pointer to time step structure * \param [in] grid pointer to array of Grid structures * *********************************************************************** */ { int ii, jj, kk; int *i, *j, *k; int in, nv; static double one_third = 1.0/3.0; static State_1D state; static Data_Arr UU, UU_1; double dt; double *inv_dl, dl2; static double ***C_dt[NVAR], **dcoeff; Index indx; /* ---------------------------------------------------- Allocate memory ---------------------------------------------------- */ if (state.rhs == NULL){ MakeState (&state); UU = ARRAY_4D(NX3_TOT, NX2_TOT, NX1_TOT, NVAR, double); UU_1 = ARRAY_4D(NX3_TOT, NX2_TOT, NX1_TOT, NVAR, double); #if (PARABOLIC_FLUX & EXPLICIT) dcoeff = ARRAY_2D(NMAX_POINT, NVAR, double); #endif /* ------------------------------------------------------- C_dt is an array used to storee the inverse time step for advection and diffusion. We use C_dt[RHO] for advection, C_dt[MX1] for viscosity, C_dt[BX1...BX3] for resistivity C_dt[MX2] for ambipolar diffusion MHD and C_dt[ENG] for thermal conduction. ------------------------------------------------------- */ C_dt[RHO] = ARRAY_3D(NX3_TOT, NX2_TOT, NX1_TOT, double); #if VISCOSITY == EXPLICIT C_dt[MX1] = ARRAY_3D(NX3_TOT, NX2_TOT, NX1_TOT, double); #endif #if RESISTIVE_MHD == EXPLICIT EXPAND(C_dt[BX1] = ARRAY_3D(NX3_TOT, NX2_TOT, NX1_TOT, double); ,