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 assign(const dmat< S > &m)
copy a mtrix.
void set_size(const short irows, const short icols)
set the matrix dimensions
void disp(const char *name)
Comfort class. Provides getter functions to access the mesh member variables more comfortably.
Point fiber() const
Get element fiber direction.
void integration_points(const short order, Point *ip, double *w, int &nint) const
elem_t type() const
Getter function for the element type.
const T & global_node(short nidx) const
Access the connectivity information.
size_t global_element_index() const
Get currently selected element index.
size_t element_index() const
Get currently selected element index.
bool has_sheet() const
Check if a sheet direction is present.
T num_nodes() const
Getter function for the number of nodes.
Point sheet() const
Get element sheet direction.
size_t size() const
The current size of the vector.
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.
void dpn(mesh_int_t &row_dpn, mesh_int_t &col_dpn)
return (by reference) the row and column dimensions
void dpn(mesh_int_t &row_dpn, mesh_int_t &col_dpn)
return (by reference) the row and column dimensions
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.
void get_transformed_pts(const element_view< T, S > &view, Point *loc_pts, Point &trsf_fibre)
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 ...
double inner_prod(const Point &a, const Point &b)
void outer_prod(const Point &a, const Point &b, const double s, double *buff, const bool add=false)
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 reference_shape(const elem_t type, const Point ip, dmat< double > &rshape)
Compute shape function and its derivatives on a reference element.
@ NBR_ELEM_REF
The element numbering of the reference mesh (the one stored on HD).
@ NBR_REF
The nodal numbering of the reference mesh (the one stored on HD).
void invert_jacobian_matrix(const elem_t type, double *J, double &detJ)
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)
vec3< V > cross(const vec3< V > &a, const vec3< V > &b)
void get_conductivity_evals(const elecMaterial &emat, const bool is_bath, double *evals)
void print_points(SF::Point *pts, int npts)
int get_preferred_int_order(SF::elem_t &etype, int mat_type)
void get_conductivity(const double *evals, const SF::Point *f, const SF::Point *s, SF::dmat< double > &cond)
SF::vector< RegionSpecs > regions
array with region params
SF::vector< double > el_scale
optionally provided per-element params scale
SF::vector< int > regionIDs
elemental region IDs (multiple tags are grouped in one region)
region based variations of arbitrary material parameters
physMaterial * material
material parameter description
double ExVal[3]
extracellular conductivity eigenvalues
cond_t g
rule to build conductivity tensor
double InVal[3]
intracellular conductivity eigenvalues
double BathVal[3]
bath conductivity eigenvalues
physMat_t material_type
ID of physics material.