/usr/include/mpb/maxwell.h is in mpb-dev 1.5-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | /* Copyright (C) 1999-2014 Massachusetts Institute of Technology.
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MAXWELL_H
#define MAXWELL_H
#ifdef MPB_REAL
# define real mpb_real
#endif
#include "scalar.h"
#include "matrices.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* This data structure is designed to hold k+G related data at a given
point. kmag is the length of the k+G vector. The m and n vectors are
orthonormal vectors orthogonal to (kx,ky,kz). These are used
as the basis for the H vector (to maintain transversality). */
typedef struct {
real kmag;
real mx, my, mz;
real nx, ny, nz;
} k_data;
/* Data structure to hold the upper triangle of a symmetric real matrix
or possibly a Hermitian complex matrix (e.g. the dielectric tensor). */
typedef struct {
#ifdef WITH_HERMITIAN_EPSILON
real m00, m11, m22;
scalar_complex m01, m02, m12;
# define ESCALAR_RE(z) CSCALAR_RE(z)
# define ESCALAR_IM(z) CSCALAR_IM(z)
# define ESCALAR_NORMSQR(z) CSCALAR_NORMSQR(z)
# define ASSIGN_ESCALAR(z, re, im) CASSIGN_SCALAR(z, re, im)
# define ESCALAR_MULT_CONJ_RE(a, b) CSCALAR_MULT_CONJ_RE(a, b)
# define ESCALAR_MULT_CONJ_IM(a, b) CSCALAR_MULT_CONJ_IM(a, b)
#else
real m00, m01, m02,
m11, m12,
m22;
# define ESCALAR_RE(z) (z)
# define ESCALAR_IM(z) (0.0)
# define ESCALAR_NORMSQR(z) ((z) * (z))
# define ASSIGN_ESCALAR(z, re, im) (z) = (re);
# define ESCALAR_MULT_CONJ_RE(a, b) ((a) * (b))
# define ESCALAR_MULT_CONJ_IM(a, b) (0.0)
#endif
} symmetric_matrix;
#ifdef WITH_HERMITIAN_EPSILON
# define DIAG_SYMMETRIC_MATRIX(m) ((m).m01.re == 0.0 && (m).m01.im == 0.0 && \
(m).m02.re == 0.0 && (m).m02.im == 0.0 && \
(m).m12.re == 0.0 && (m).m12.im == 0.0)
#else
# define DIAG_SYMMETRIC_MATRIX(m) ((m).m01 == 0.0 && \
(m).m02 == 0.0 && \
(m).m12 == 0.0)
#endif
#define NO_PARITY (0)
#define EVEN_Z_PARITY (1<<0)
#define ODD_Z_PARITY (1<<1)
#define EVEN_Y_PARITY (1<<2)
#define ODD_Y_PARITY (1<<3)
#define MAX_NPLANS 32
typedef struct {
int nx, ny, nz;
int local_nx, local_ny;
int local_x_start, local_y_start;
int last_dim, last_dim_size, other_dims;
int num_bands;
int N, local_N, N_start, alloc_N;
int fft_output_size;
int max_fft_bands, num_fft_bands;
real current_k[3]; /* (in cartesian basis) */
int parity;
void *plans[MAX_NPLANS], *iplans[MAX_NPLANS];
int nplans, plans_howmany[MAX_NPLANS], plans_stride[MAX_NPLANS], plans_dist[MAX_NPLANS];
scalar *fft_data, *fft_data2;
int zero_k; /* non-zero if k is zero (handled specially) */
k_data *k_plus_G;
real *k_plus_G_normsqr;
symmetric_matrix *eps_inv;
real eps_inv_mean;
} maxwell_data;
extern maxwell_data *create_maxwell_data(int nx, int ny, int nz,
int *local_N, int *N_start,
int *alloc_N,
int num_bands,
int num_fft_bands);
extern void destroy_maxwell_data(maxwell_data *d);
extern void maxwell_set_num_bands(maxwell_data *d, int num_bands);
extern void update_maxwell_data_k(maxwell_data *d, real k[3],
real G1[3], real G2[3], real G3[3]);
extern void set_maxwell_data_parity(maxwell_data *d, int parity);
typedef void (*maxwell_dielectric_function) (symmetric_matrix *eps,
symmetric_matrix *eps_inv,
const real r[3],
void *epsilon_data);
typedef int (*maxwell_dielectric_mean_function) (symmetric_matrix *meps,
symmetric_matrix *meps_inv,
real n[3],
real d1, real d2, real d3,
real tol,
const real r[3],
void *epsilon_data);
extern void set_maxwell_dielectric(maxwell_data *md,
const int mesh_size[3],
real R[3][3], real G[3][3],
maxwell_dielectric_function epsilon,
maxwell_dielectric_mean_function mepsilon,
void *epsilon_data);
extern void maxwell_sym_matrix_eigs(real eigs[3], const symmetric_matrix *V);
extern void maxwell_sym_matrix_invert(symmetric_matrix *Vinv,
const symmetric_matrix *V);
extern void maxwell_sym_matrix_rotate(symmetric_matrix *RAR,
const symmetric_matrix *A_,
const double R[3][3]);
extern int maxwell_sym_matrix_positive_definite(symmetric_matrix *V);
extern void maxwell_compute_fft(int dir, maxwell_data *d,
scalar *array_in, scalar *array_out,
int howmany, int stride, int dist);
extern void maxwell_compute_d_from_H(maxwell_data *d, evectmatrix Xin,
scalar_complex *dfield,
int cur_band_start, int cur_num_bands);
extern void maxwell_compute_h_from_H(maxwell_data *d, evectmatrix Hin,
scalar_complex *hfield,
int cur_band_start, int cur_num_bands);
extern void maxwell_compute_e_from_d(maxwell_data *d,
scalar_complex *dfield,
int cur_num_bands);
extern void maxwell_vectorfield_otherhalf(maxwell_data *d,
scalar_complex *field,
real phasex,real phasey,real phasez);
extern void maxwell_cscalarfield_otherhalf(maxwell_data *d,
scalar_complex *field,
real phasex, real phasey,
real phasez);
extern void maxwell_scalarfield_otherhalf(maxwell_data *d, real *field);
void assign_symmatrix_vector(scalar_complex *newv,
const symmetric_matrix matrix,
const scalar_complex *oldv);
extern void maxwell_operator(evectmatrix Xin, evectmatrix Xout, void *data,
int is_current_eigenvector, evectmatrix Work);
extern void maxwell_simple_precondition(evectmatrix X,
void *data, real *eigenvals);
extern void maxwell_preconditioner(evectmatrix Xin, evectmatrix Xout,
void *data,
evectmatrix Y, real *eigenvals,
sqmatrix YtY);
extern void maxwell_preconditioner2(evectmatrix Xin, evectmatrix Xout,
void *data,
evectmatrix Y, real *eigenvals,
sqmatrix YtY);
extern void maxwell_ucross_op(evectmatrix Xin, evectmatrix Xout,
maxwell_data *d, const real u[3]);
extern void maxwell_parity_constraint(evectmatrix X, void *data);
extern void maxwell_zparity_constraint(evectmatrix X, void *data);
extern void maxwell_yparity_constraint(evectmatrix X, void *data);
extern int maxwell_zero_k_num_const_bands(evectmatrix X, maxwell_data *d);
extern void maxwell_zero_k_set_const_bands(evectmatrix X, maxwell_data *d);
extern void maxwell_zero_k_constraint(evectmatrix X, void *data);
extern double *maxwell_zparity(evectmatrix X, maxwell_data *d);
extern double *maxwell_yparity(evectmatrix X, maxwell_data *d);
typedef struct {
maxwell_data *d;
real target_frequency;
} maxwell_target_data;
extern maxwell_target_data *create_maxwell_target_data(maxwell_data *d,
real target_frequency);
extern void destroy_maxwell_target_data(maxwell_target_data *d);
extern void maxwell_target_operator1(evectmatrix Xin, evectmatrix Xout,
void *data,
int is_current_eigenvector,
evectmatrix Work);
extern void maxwell_target_operator(evectmatrix Xin, evectmatrix Xout,
void *data, int is_current_eigenvector,
evectmatrix Work);
extern void maxwell_target_preconditioner(evectmatrix Xin, evectmatrix Xout,
void *data,
evectmatrix Y, real *eigenvals,
sqmatrix YtY);
extern void maxwell_target_preconditioner2(evectmatrix Xin, evectmatrix Xout,
void *data,
evectmatrix Y, real *eigenvals,
sqmatrix YtY);
extern void spherical_quadrature_points(real *x, real *y, real *z,
real *weight, int num_sq_pts);
extern int check_maxwell_dielectric(maxwell_data *d,
int negative_epsilon_okp);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#ifdef MPB_REAL
# undef real
#endif
#endif /* MAXWELL_H */
|