#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "../../FTensor.hpp"
Go to the source code of this file.
|
void | initial (double P1[], double P2[], double P3[], double c[], const int N) |
|
void | FTen (double P1_[], double P2_[], double P3_[], double c_[], const int N) |
|
void | simple (double P1[], double P2[], double P3[], double c[], const int N) |
|
int | main (int argc, char *argv[]) |
|
◆ FTen()
Definition at line 42 of file acoustic.cpp.
50 for(
int j = 0;
j <
N; ++
j)
51 for(
int i = 0;
i <
N; ++
i)
53 if(
i != 0 &&
i !=
N - 1 &&
j != 0 &&
j !=
N - 1)
58 * (
dd(P2,
l,
m, d_ijk, d_xyz)(0, 0)
59 +
dd(P2,
l,
m, d_ijk, d_xyz)(1, 1));
◆ initial()
Definition at line 9 of file acoustic.cpp.
12 int cc = 7.0 *
N / 8.0 - 1;
13 float s2 = 64.0 * 9.0 / pow(
N / 2.0, 2.0);
15 for(
int i = 0;
i <
N; ++
i)
16 for(
int j = 0;
j <
N; ++
j)
20 P2[
i +
N *
j] = exp(-(pow(
i - cr, 2.0) + pow(
j - cc, 2.0)) * s2);
24 const int blockLeft = 0;
25 const int blockRight = 2 *
N / 5.0;
26 const int blockTop =
N / 3.0;
27 const int blockBottom = 2 *
N / 3.0;
29 for(
int i = blockTop;
i < blockBottom; ++
i)
30 for(
int j = blockLeft;
j < blockRight; ++
j)
33 int channelLeft = 4 *
N / 5.0;
35 int channel1Height = 3 *
N / 8.0;
36 int channel2Height = 5 *
N / 8.0;
37 for(
int i = channelLeft;
i < channelRight; ++
i)
38 for(
int j = channel1Height;
j < channel2Height; ++
j)
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 83 of file acoustic.cpp.
85 const int N = atoi(argv[1]);
87 vector<double> P1(
N *
N), P2(
N *
N), P3(
N *
N),
c(
N *
N);
89 initial(&
c[0], &P1[0], &P2[0], &P3[0],
N);
91 const int niters = atoi(argv[2]);
93 for(
int i = 0;
i < niters; ++
i)
98 FTen(&P1[0], &P2[0], &P3[0], &
c[0],
N);
99 FTen(&P2[0], &P3[0], &P1[0], &
c[0],
N);
100 FTen(&P3[0], &P1[0], &P2[0], &
c[0],
N);
◆ simple()
- Examples
- adolc_plasticity.cpp, approx_sphere.cpp, dg_projection.cpp, dynamic_first_order_con_law.cpp, eigen_elastic.cpp, free_surface.cpp, hdiv_check_approx_in_3d.cpp, heat_equation.cpp, heat_method.cpp, hello_world.cpp, level_set.cpp, mortar_contact.cpp, NonlinearElasticElementInterface.hpp, operators_tests.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, scalar_check_approximation.cpp, schur_test_diag_mat.cpp, seepage.cpp, shallow_wave.cpp, tensor_divergence_operator.cpp, test_broken_space.cpp, thermo_elastic.cpp, and wave_equation.cpp.
Definition at line 69 of file acoustic.cpp.
71 for(
int j = 1;
j <
N - 1; ++
j)
72 for(
int i = 1;
i <
N - 1; ++
i)
75 P3[
i +
N *
j] = (2 - 4 *
c[
i +
N *
j]) * P2[
i +
N *
j] - P1[
i +
N *
j]
77 * (P2[
i - 1 +
N *
j] + P2[
i + 1 +
N *
j]
78 + P2[
i +
N * (
j - 1)] + P2[
i +
N * (
j + 1)]);
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)