zbesh_interface.cpp

来自「这个软件包(C++)是我寻找电磁学代码无意中找到了」· C++ 代码 · 共 52 行

CPP
52
字号
/********************************************************************** * * zbesh_interface.cpp * * Copyright (C) 2007, 2008 Idesbald Van den Bosch * * This file is part of Puma-EM. *  * Puma-EM is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. *  * Puma-EM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with Puma-EM.  If not, see <http://www.gnu.org/licenses/>. * * Suggestions/bugs : <vandenbosch.idesbald@gmail.com> * **********************************************************************/#include <iostream>#include <complex>//#include <blitz/array.h>/*%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*% interface to the actual (fortran) ZBESH routine%*/using namespace std;const complex<double> I (0.0, 1.0);extern "C" {  //SUBROUTINE ZBESH(ZR, ZI, FNU, KODE, M, N, CYR, CYI, NZ, IERR)  void zbesh_(double *, double *, double *, int *, int *, int *, double *, double *, int *, int *);}void zbesh(complex<double>& z_cmplx, double & fnu, int & kode, int & M, int & N, complex<double>& h, int & nz, int & ierr) {  double zr = real(z_cmplx), zi = imag(z_cmplx), cyr, cyi;  zbesh_(&zr, &zi, &fnu, &kode, &M, &N, &cyr, &cyi, &nz, &ierr);  if (ierr>0) {    if ((zr>0.0) || (zi>0.0)) cout << "Error in computation of zbesh. Error code: " << ierr << endl;  }  h = cyr + I * cyi;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?