/******************************************************** * ██████╗ ██████╗████████╗██╗ * ██╔════╝ ██╔════╝╚══██╔══╝██║ * ██║ ███╗██║ ██║ ██║ * ██║ ██║██║ ██║ ██║ * ╚██████╔╝╚██████╗ ██║ ███████╗ * ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝ * Geophysical Computational Tools & Library (GCTL) * * Copyright (c) 2022 Yi Zhang (yizhang-geo@zju.edu.cn) * * GCTL is distributed under a dual licensing scheme. You can redistribute * it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 2 * of the License, or (at your option) any later version. You should have * received a copy of the GNU Lesser General Public License along with this * program. If not, see . * * If the terms and conditions of the LGPL v.2. would prevent you from using * the GCTL, please consider the option to obtain a commercial license for a * fee. These licenses are offered by the GCTL's original author. As a rule, * licenses are provided "as-is", unlimited in time for a one time fee. Please * send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget * to include some description of your company and the realm of its activities. * Also add information on how to contact you by electronic and paper mail. ******************************************************/ #include "gctl/core.h" #include "gctl/io.h" #include "gctl/potential.h" using namespace gctl; int main(int argc, char const *argv[]) { try { int obs_num = 101; // set up observation points array obs_loc; linespace(point2dc(0.0, 0.0), point2dc(200.0, 0.0), obs_num, obs_loc); // set nodes locations array node_vert(3); node_vert[0].set(point2dc(80.0, -30.0)); node_vert[1].set(point2dc(105.0, -60.0)); node_vert[2].set(point2dc(106.0, -10.0)); // set triangular elements array rho(2, 1.0); array tri(2); // anti-clock wise tri[0].set(node_vert[0], node_vert[1], node_vert[2]); // set triangle's vertex from existing vertex tri[1].set(point2dc(135.0, -5.0), point2dc(141.0, -40.0), point2dc(145.0, -15.0)); // set triangle's vertex from parameters // forward modeling array g(obs_num); array gx(obs_num); array gz(obs_num); gobser(g, tri, obs_loc, rho, gctl::Vz); gobser(gx, tri, obs_loc, rho, gctl::Tzx); gobser(gz, tri, obs_loc, rho, gctl::Tzz); for (int i = 0; i < obs_num; ++i) { std::cout << obs_loc[i] << " " << g[i] << " " << gx[i] << " " << gz[i] << std::endl; } } catch (std::exception &e) { GCTL_ShowWhatError(e.what(), GCTL_ERROR_ERROR, 0, 0, 0); } return 0; }