31 #define ELEC_STIFFNESS 1 62 const char* msg_start)
65 printf(
"\n%s", msg_start);
68 printf(
"gregion[%d], ", *reg);
75 printf(
"\nVolume: %g", vol);
79 printf(
", fib: (%g, %g, %g), she: (%g, %g, %g), G: (%g, %g, %g)",
80 fib.
x, fib.
y, fib.
z, she.x, she.y, she.z, eVals[0]*1e3, eVals[1]*1e3, eVals[2]*1e3);
90 if(is_bath ==
false) {
93 evals[0] = emat.
InVal[0], evals[1] = emat.
InVal[1], evals[2] = emat.
InVal[2];
97 evals[0] = emat.
ExVal[0], evals[1] = emat.
ExVal[1], evals[2] = emat.
ExVal[2];
125 double gl = evals[0], gt = evals[1], gn = evals[2];
132 cond[0][0] += gt, cond[1][1] += gt, cond[2][2] += gt;
147 for(
int i=0; i<npts; i++)
148 printf(
" ( %g %g %g ) \n", pts[i].x, pts[i].y, pts[i].z);
177 eVals[0] *= material.
el_scale[eidx];
178 eVals[1] *= material.
el_scale[eidx];
179 eVals[2] *= material.
el_scale[eidx];
197 buff.
assign(ndof, ndof, 0.0);
203 bool have_nan =
false;
206 for(
int iidx=0; iidx < nint; iidx++)
216 memcpy(Jbuff.
data(), J, 9*
sizeof(double));
217 std::string j_name =
"J_" + std::to_string(iidx);
218 Jbuff.
disp(j_name.c_str());
223 double dx = w[iidx] * detj;
226 for (
int k = 0; k < ndof; k++) {
228 double skx = gshape[1][k], sky = gshape[2][k], skz = gshape[3][k];
229 double cx = cond[0][0] * skx + cond[0][1] * sky + cond[0][2] * skz;
230 double cy = cond[1][0] * skx + cond[1][1] * sky + cond[1][2] * skz;
231 double cz = cond[2][0] * skx + cond[2][1] * sky + cond[2][2] * skz;
233 for (
int l = 0; l < ndof; l++) {
235 double slx = gshape[1][l], sly = gshape[2][l], slz = gshape[3][l];
236 double val = - (cx*slx + cy * sly + cz * slz) * dx;
239 if(val != val) have_nan =
true;
245 printf(
"\n vol: %g \n\n", vol);
246 buff.
disp(
"Element Matrix:");
270 buff.
assign(ndof, ndof, 0.0);
275 bool have_nan =
false;
281 for(
int iidx=0; iidx < nint; iidx++)
289 double dx = w[iidx] * detj;
292 for (
int k = 0; k < ndof; k++) {
293 double sk = shape[0][k];
294 for (
int l = 0; l < ndof; l++) {
295 double sl = shape[0][l];
296 double val = sk * sl * dx;
299 if(val != val) have_nan =
true;
void dpn(mesh_int_t &row_dpn, mesh_int_t &col_dpn)
return (by reference) the row and column dimensions
cond_t g
rule to build conductivity tensor
void get_conductivity(const double *evals, const SF::Point *f, const SF::Point *s, SF::dmat< double > &cond)
void get_transformed_pts(const element_view< T, S > &view, Point *loc_pts, Point &trsf_fibre)
physMaterial * material
material parameter description
void reference_shape(const elem_t type, const Point ip, dmat< double > &rshape)
Compute shape function and its derivatives on a reference element.
physMat_t material_type
ID of physics material.
void print_element_info(const SF::element_view< mesh_int_t, mesh_real_t > &elem, const int *reg, const double vol, const double *eVals, const char *msg_start)
Comfort class. Provides getter functions to access the mesh member variables more comfortably...
void jacobian_matrix(const dmat< double > &rshape, const int npts, const Point *pts, double *J)
Compute Jacobian matrix from the real element to the reference element.
void set_size(const short irows, const short icols)
set the matrix dimensions
double ExVal[3]
extracellular conductivity eigenvalues
The nodal numbering of the reference mesh (the one stored on HD).
size_t element_index() const
Get currently selected element index.
double inner_prod(const Point &a, const Point &b)
void get_conductivity_evals(const elecMaterial &emat, const bool is_bath, double *evals)
void assign(const dmat< S > &m)
copy a mtrix.
double InVal[3]
intracellular conductivity eigenvalues
SF::vector< int > regionIDs
elemental region IDs (multiple tags are grouped in one region)
int get_preferred_int_order(SF::elem_t &etype, int mat_type)
void shape_deriv(const double *iJ, const dmat< double > &rshape, const int ndof, dmat< double > &shape)
Compute shape derivatives for an element, based on the shape derivatives of the associated reference ...
Point sheet() const
Get element sheet direction.
Point fiber() const
Get element fiber direction.
elem_t type() const
Getter function for the element type.
vec3< V > cross(const vec3< V > &a, const vec3< V > &b)
The element numbering of the reference mesh (the one stored on HD).
void print_points(SF::Point *pts, int npts)
void operator()(const SF::element_view< mesh_int_t, mesh_real_t > &elem, SF::dmat< double > &buff)
compute the element matrix for a given element.
region based variations of arbitrary material parameters
double BathVal[3]
bath conductivity eigenvalues
void invert_jacobian_matrix(const elem_t type, double *J, double &detJ)
void disp(const char *name)
void operator()(const SF::element_view< mesh_int_t, mesh_real_t > &elem, SF::dmat< double > &buff)
compute the element matrix for a given element.
SF::vector< double > el_scale
optionally provided per-element params scale
T num_nodes() const
Getter function for the number of nodes.
void integration_points(const short order, Point *ip, double *w, int &nint) const
void dpn(mesh_int_t &row_dpn, mesh_int_t &col_dpn)
return (by reference) the row and column dimensions
bool has_sheet() const
Check if a sheet direction is present.
void outer_prod(const Point &a, const Point &b, const double s, double *buff, const bool add=false)
size_t size() const
The current size of the vector.
const T & global_node(short nidx) const
Access the connectivity information.
SF::vector< RegionSpecs > regions
array with region params
size_t global_element_index() const
Get currently selected element index.