Real StressDivergenceRSphericalTensors::calculateJacobian(unsigned int ivar, unsigned int jvar) { RealGradient test_r, phi_r; if (ivar == 0) //Case grad_test for r, requires contributions from stress_{rr}, stress_{\theta \theta}, and stress_{\phi \phi} { test_r(0) = _grad_test[_i][_qp](0); test_r(1) = _test[_i][_qp] / _q_point[_qp](0); test_r(2) = _test[_i][_qp] / _q_point[_qp](0); } if (jvar == 0) { phi_r(0) = _grad_phi[_j][_qp](0); phi_r(1) = _phi[_j][_qp] / _q_point[_qp](0); phi_r(2) = _phi[_j][_qp] / _q_point[_qp](0); } if (ivar == 0 && jvar == 0) // Only nonzero case for a 1D simulation { return _Jacobian_mult[_qp].elasticJacobian(ivar, jvar, test_r, phi_r); } else mooseError("Invalid component in Jacobian Calculation"); }
int main(void) { test_r(r1); test_r(r2); test_r(r3); test_d(d1); test_d(d2); exit(EXIT_SUCCESS); }
int main (void) { test (ecvt_tests, ecvt, "ecvt"); test (fcvt_tests, fcvt, "fcvt"); test_r (ecvt_tests, ecvt_r, "ecvt_r"); test_r (fcvt_tests, fcvt_r, "fcvt_r"); special (); return error_count; }
RealMat derivative4order(const PetscReal r, const PetscReal s, const PetscReal t, const PetscInt order) { PetscInt size = (order + 1) * (order + 1) * (order + 1); RealVec test_r(size), test_s(size), test_t(size); if (order == 1) { interpolate_r_derivative_order1_hex(s, t, test_r.data()); interpolate_s_derivative_order1_hex(r, t, test_s.data()); interpolate_t_derivative_order1_hex(r, s, test_t.data()); } else if (order == 2) { interpolate_r_derivative_order2_hex(r, s, t, test_r.data()); interpolate_s_derivative_order2_hex(r, s, t, test_s.data()); interpolate_t_derivative_order2_hex(r, s, t, test_t.data()); } else if (order == 3) { interpolate_r_derivative_order3_hex(r, s, t, test_r.data()); interpolate_s_derivative_order3_hex(r, s, t, test_s.data()); interpolate_t_derivative_order3_hex(r, s, t, test_t.data()); } else if (order == 4) { interpolate_r_derivative_order4_hex(r, s, t, test_r.data()); interpolate_s_derivative_order4_hex(r, s, t, test_s.data()); interpolate_t_derivative_order4_hex(r, s, t, test_t.data()); } else if (order == 5) { interpolate_r_derivative_order5_hex(r, s, t, test_r.data()); interpolate_s_derivative_order5_hex(r, s, t, test_s.data()); interpolate_t_derivative_order5_hex(r, s, t, test_t.data()); } else if (order == 6) { interpolate_r_derivative_order6_hex(r, s, t, test_r.data()); interpolate_s_derivative_order6_hex(r, s, t, test_s.data()); interpolate_t_derivative_order6_hex(r, s, t, test_t.data()); } else if (order == 7) { interpolate_r_derivative_order7_hex(r, s, t, test_r.data()); interpolate_s_derivative_order7_hex(r, s, t, test_s.data()); interpolate_t_derivative_order7_hex(r, s, t, test_t.data()); } #if HEX_MAX_ORDER > 7 else if (order == 8) { interpolate_r_derivative_order8_hex(r, s, t, test_r.data()); interpolate_s_derivative_order8_hex(r, s, t, test_s.data()); interpolate_t_derivative_order8_hex(r, s, t, test_t.data()); } else if (order == 9) { interpolate_r_derivative_order9_hex(r, s, t, test_r.data()); interpolate_s_derivative_order9_hex(r, s, t, test_s.data()); interpolate_t_derivative_order9_hex(r, s, t, test_t.data()); } #endif else { ERROR() << "Order " << order << " not supported"; } RealMat ret(size, 3); ret.col(0) = test_r; ret.col(1) = test_s; ret.col(2) = test_t; return ret; }
void test_device() { //1. lll...... FAT_PRINT("test read...\n"); test_r(); FAT_PRINT("test write...\n"); test_w(); FAT_PRINT("test read&write...\n"); test_rw(); }
static void strt_cnt(void) { R.countON = 1; Old_T1 = test_r(1); } /* NS990113 */
static void jt_1(void) { UINT8 i=M_RDMEM_OPCODE(); if (test_r(1)) { R.PC.w.l = (R.PC.w.l & 0xf00) | i; /*change_pc(R.PC.w.l);*/ } }
static void jnt_0(void) { UINT8 i=M_RDMEM_OPCODE(); if (!test_r(0)) { R.PC.w.l = (R.PC.w.l & 0xf00) | i; /*change_pc(R.PC.w.l);*/ } }
static void strt_cnt(void) { R.countON = 1; R.timerON = 0; R.Old_T1 = test_r(1); } /* NS990113 */
static void jt_1(void) { UINT8 i=M_RDMEM_OPCODE(); if (test_r(1)) { R.PC.w.l = ((R.PC.w.l-1) & 0xf00) | i; change_pc(R.PC.w.l); } else ADJUST_CYCLES }
/* y = ax^b + c * return 0 if success, -1 otherwise * if success, a, b and c are modified * */ int _starpu_regression_non_linear_power(struct starpu_history_list_t *ptr, double *a, double *b, double *c) { unsigned n = find_list_size(ptr); unsigned *x = malloc(n*sizeof(unsigned)); STARPU_ASSERT(x); double *y = malloc(n*sizeof(double)); STARPU_ASSERT(y); dump_list(x, y, ptr); double cmin = 0.0; double cmax = find_list_min(y, n); unsigned iter; double err = 100000.0; for (iter = 0; iter < MAXREGITER; iter++) { double c1, c2; double r1, r2; double radius = 0.01; c1 = cmin + (0.5-radius)*(cmax - cmin); c2 = cmin + (0.5+radius)*(cmax - cmin); r1 = test_r(c1, n, x, y); r2 = test_r(c2, n, x, y); double err1, err2; err1 = fabs(1.0 - r1); err2 = fabs(1.0 - r2); if (err1 < err2) { cmax = (cmin + cmax)/2; } else { /* 2 is better */ cmin = (cmin + cmax)/2; } if (fabs(err - STARPU_MIN(err1, err2)) < EPS) { err = STARPU_MIN(err1, err2); break; } err = STARPU_MIN(err1, err2); } *c = (cmin + cmax)/2; *b = compute_b(*c, n, x, y); *a = exp(compute_a(*c, *b, n, x, y)); free(x); free(y); return 0; }
static void jnt_1(void) { UINT8 i=M_RDMEM_OPCODE(); if (!test_r(1)) { R.PC.w.l = ((R.PC.w.l-1) & 0xf00) | i; } else ADJUST_CYCLES }
static void jnt_0(void) { UINT8 i=M_RDMEM_OPCODE(); if (!test_r(0)) { R.PC.w.l = ((R.PC.w.l-1) & 0xf00) | i; change_pc16(R.PC.w.l); } else ADJUST_CYCLES }