v0.14.0
Functions
tetrahedron_nco_rule.c File Reference
#include "tetrahedron_nco_rule.h"

Go to the source code of this file.

Functions

double r8mat_det_4d (double a[])
 
void reference_to_physical_t4 (double t[], int n, double ref[], double phy[])
 
int tetrahedron_nco_degree (int rule)
 
int tetrahedron_nco_order_num (int rule)
 
void tetrahedron_nco_rule (int rule, int order_num, double xyz[], double w[])
 
int tetrahedron_nco_rule_num ()
 
int * tetrahedron_nco_suborder (int rule, int suborder_num)
 
int tetrahedron_nco_suborder_num (int rule)
 
void tetrahedron_nco_subrule (int rule, int suborder_num, double suborder_xyz[], double suborder_w[])
 
void tetrahedron_nco_subrule_01 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_02 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_03 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_04 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_05 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_06 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
void tetrahedron_nco_subrule_07 (int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
 
double tetrahedron_volume (double tetra[3 *4])
 

Function Documentation

◆ r8mat_det_4d()

double r8mat_det_4d ( double  a[])

Definition at line 6 of file tetrahedron_nco_rule.c.

37 {
38  double det;
39 
40  det =
41  a[0+0*4] * (
42  a[1+1*4] * ( a[2+2*4] * a[3+3*4] - a[2+3*4] * a[3+2*4] )
43  - a[1+2*4] * ( a[2+1*4] * a[3+3*4] - a[2+3*4] * a[3+1*4] )
44  + a[1+3*4] * ( a[2+1*4] * a[3+2*4] - a[2+2*4] * a[3+1*4] ) )
45  - a[0+1*4] * (
46  a[1+0*4] * ( a[2+2*4] * a[3+3*4] - a[2+3*4] * a[3+2*4] )
47  - a[1+2*4] * ( a[2+0*4] * a[3+3*4] - a[2+3*4] * a[3+0*4] )
48  + a[1+3*4] * ( a[2+0*4] * a[3+2*4] - a[2+2*4] * a[3+0*4] ) )
49  + a[0+2*4] * (
50  a[1+0*4] * ( a[2+1*4] * a[3+3*4] - a[2+3*4] * a[3+1*4] )
51  - a[1+1*4] * ( a[2+0*4] * a[3+3*4] - a[2+3*4] * a[3+0*4] )
52  + a[1+3*4] * ( a[2+0*4] * a[3+1*4] - a[2+1*4] * a[3+0*4] ) )
53  - a[0+3*4] * (
54  a[1+0*4] * ( a[2+1*4] * a[3+2*4] - a[2+2*4] * a[3+1*4] )
55  - a[1+1*4] * ( a[2+0*4] * a[3+2*4] - a[2+2*4] * a[3+0*4] )
56  + a[1+2*4] * ( a[2+0*4] * a[3+1*4] - a[2+1*4] * a[3+0*4] ) );
57 
58  return det;
59 }

◆ reference_to_physical_t4()

void reference_to_physical_t4 ( double  t[],
int  n,
double  ref[],
double  phy[] 
)

Definition at line 62 of file tetrahedron_nco_rule.c.

108 {
109  int i;
110  int j;
111 
112  for ( i = 0; i < 3; i++ )
113  {
114  for ( j = 0; j < n; j++ )
115  {
116  phy[i+j*3] = t[i+0*3] * ( 1.0 - ref[0+j*3] - ref[1+j*3] - ref[2+j*3] )
117  + t[i+1*3] * + ref[0+j*3]
118  + t[i+2*3] * + ref[1+j*3]
119  + t[i+3*3] * + ref[2+j*3];
120  }
121  }
122 
123  return;
124 }

◆ tetrahedron_nco_degree()

int tetrahedron_nco_degree ( int  rule)

Definition at line 127 of file tetrahedron_nco_rule.c.

161 {
162  int degree;
163 
164  if ( 1 <= rule && rule <= 7 )
165  {
166  degree = rule - 1;
167  }
168  else
169  {
170  degree = -1;
171  fprintf ( stderr, "\n" );
172  fprintf ( stderr, "TETRAHEDRON_NCO_DEGREE - Fatal error!\n" );
173  fprintf ( stderr, " Illegal RULE = %d\n", rule );
174  exit ( 1 );
175  }
176 
177  return degree;
178 }

◆ tetrahedron_nco_order_num()

int tetrahedron_nco_order_num ( int  rule)

Definition at line 181 of file tetrahedron_nco_rule.c.

215 {
216  int order;
217  int order_num;
218  int *suborder;
219  int suborder_num;
220 
221  suborder_num = tetrahedron_nco_suborder_num ( rule );
222 
223  suborder = tetrahedron_nco_suborder ( rule, suborder_num );
224 
225  order_num = 0;
226  for ( order = 0; order < suborder_num; order++ )
227  {
228  order_num = order_num + suborder[order];
229  }
230 
231  free ( suborder );
232 
233  return order_num;
234 }

◆ tetrahedron_nco_rule()

void tetrahedron_nco_rule ( int  rule,
int  order_num,
double  xyz[],
double  w[] 
)

Definition at line 237 of file tetrahedron_nco_rule.c.

274 {
275  int o;
276  int s;
277  int *suborder;
278  int suborder_num;
279  double *suborder_w;
280  double *suborder_xyz;
281 /*
282  Get the suborder information.
283 */
284  suborder_num = tetrahedron_nco_suborder_num ( rule );
285 
286  suborder_xyz = ( double * ) malloc ( 4 * suborder_num * sizeof ( double ) );
287  suborder_w = ( double * ) malloc ( suborder_num * sizeof ( double ) );
288 
289  suborder = tetrahedron_nco_suborder ( rule, suborder_num );
290 
291  tetrahedron_nco_subrule ( rule, suborder_num, suborder_xyz, suborder_w );
292 /*
293  Expand the suborder information to a full order rule.
294 */
295  o = 0;
296 
297  for ( s = 0; s < suborder_num; s++ )
298  {
299  if ( suborder[s] == 1 )
300  {
301  xyz[0+o*3] = suborder_xyz[0+s*4];
302  xyz[1+o*3] = suborder_xyz[1+s*4];
303  xyz[2+o*3] = suborder_xyz[2+s*4];
304  w[o] = suborder_w[s];
305  o = o + 1;
306  }
307 /*
308  Fourfold symmetry on (A,A,A,B)
309 
310  123 AAA
311  124 AAB
312  142 ABA
313  412 BAA
314 */
315  else if ( suborder[s] == 4 )
316  {
317  xyz[0+o*3] = suborder_xyz[0+s*4];
318  xyz[1+o*3] = suborder_xyz[1+s*4];
319  xyz[2+o*3] = suborder_xyz[2+s*4];
320  w[o] = suborder_w[s];
321  o = o + 1;
322 
323  xyz[0+o*3] = suborder_xyz[0+s*4];
324  xyz[1+o*3] = suborder_xyz[1+s*4];
325  xyz[2+o*3] = suborder_xyz[3+s*4];
326  w[o] = suborder_w[s];
327  o = o + 1;
328 
329  xyz[0+o*3] = suborder_xyz[0+s*4];
330  xyz[1+o*3] = suborder_xyz[3+s*4];
331  xyz[2+o*3] = suborder_xyz[1+s*4];
332  w[o] = suborder_w[s];
333  o = o + 1;
334 
335  xyz[0+o*3] = suborder_xyz[3+s*4];
336  xyz[1+o*3] = suborder_xyz[0+s*4];
337  xyz[2+o*3] = suborder_xyz[1+s*4];
338  w[o] = suborder_w[s];
339  o = o + 1;
340  }
341 /*
342  Sixfold symmetry on (A,A,B,B):
343 
344  123 (A,A,B)
345  132 (A,B,A),
346  134 (A,B,B)
347  312 (B,A,A)
348  314 (B,A,B)
349  341 (B,B,A)
350 */
351  else if ( suborder[s] == 6 )
352  {
353  xyz[0+o*3] = suborder_xyz[0+s*4];
354  xyz[1+o*3] = suborder_xyz[1+s*4];
355  xyz[2+o*3] = suborder_xyz[2+s*4];
356  w[o] = suborder_w[s];
357  o = o + 1;
358 
359  xyz[0+o*3] = suborder_xyz[0+s*4];
360  xyz[1+o*3] = suborder_xyz[2+s*4];
361  xyz[2+o*3] = suborder_xyz[1+s*4];
362  w[o] = suborder_w[s];
363  o = o + 1;
364 
365  xyz[0+o*3] = suborder_xyz[0+s*4];
366  xyz[1+o*3] = suborder_xyz[2+s*4];
367  xyz[2+o*3] = suborder_xyz[3+s*4];
368  w[o] = suborder_w[s];
369  o = o + 1;
370 
371  xyz[0+o*3] = suborder_xyz[2+s*4];
372  xyz[1+o*3] = suborder_xyz[0+s*4];
373  xyz[2+o*3] = suborder_xyz[1+s*4];
374  w[o] = suborder_w[s];
375  o = o + 1;
376 
377  xyz[0+o*3] = suborder_xyz[2+s*4];
378  xyz[1+o*3] = suborder_xyz[0+s*4];
379  xyz[2+o*3] = suborder_xyz[3+s*4];
380  w[o] = suborder_w[s];
381  o = o + 1;
382 
383  xyz[0+o*3] = suborder_xyz[2+s*4];
384  xyz[1+o*3] = suborder_xyz[3+s*4];
385  xyz[2+o*3] = suborder_xyz[0+s*4];
386  w[o] = suborder_w[s];
387  o = o + 1;
388  }
389 /*
390  Twelvefold symmetry on (A,A,B,C):
391 
392  123 (A,A,B)
393  124 (A,A,C)
394  132 (A,B,A)
395  134 (A,B,C)
396  142 (A,C,A)
397  143 (A,C,B)
398  312 (B,A,A)
399  314 (B,A,C)
400  341 (B,C,A)
401  412 (C,A,A)
402  413 (C,A,B)
403  431 (C,B,A)
404 */
405  else if ( suborder[s] == 12 )
406  {
407  xyz[0+o*3] = suborder_xyz[0+s*4];
408  xyz[1+o*3] = suborder_xyz[1+s*4];
409  xyz[2+o*3] = suborder_xyz[2+s*4];
410  w[o] = suborder_w[s];
411  o = o + 1;
412 
413  xyz[0+o*3] = suborder_xyz[0+s*4];
414  xyz[1+o*3] = suborder_xyz[1+s*4];
415  xyz[2+o*3] = suborder_xyz[3+s*4];
416  w[o] = suborder_w[s];
417  o = o + 1;
418 
419  xyz[0+o*3] = suborder_xyz[0+s*4];
420  xyz[1+o*3] = suborder_xyz[2+s*4];
421  xyz[2+o*3] = suborder_xyz[1+s*4];
422  w[o] = suborder_w[s];
423  o = o + 1;
424 
425  xyz[0+o*3] = suborder_xyz[0+s*4];
426  xyz[1+o*3] = suborder_xyz[2+s*4];
427  xyz[2+o*3] = suborder_xyz[3+s*4];
428  w[o] = suborder_w[s];
429  o = o + 1;
430 
431  xyz[0+o*3] = suborder_xyz[0+s*4];
432  xyz[1+o*3] = suborder_xyz[3+s*4];
433  xyz[2+o*3] = suborder_xyz[1+s*4];
434  w[o] = suborder_w[s];
435  o = o + 1;
436 
437  xyz[0+o*3] = suborder_xyz[0+s*4];
438  xyz[1+o*3] = suborder_xyz[3+s*4];
439  xyz[2+o*3] = suborder_xyz[2+s*4];
440  w[o] = suborder_w[s];
441  o = o + 1;
442 
443  xyz[0+o*3] = suborder_xyz[2+s*4];
444  xyz[1+o*3] = suborder_xyz[0+s*4];
445  xyz[2+o*3] = suborder_xyz[1+s*4];
446  w[o] = suborder_w[s];
447  o = o + 1;
448 
449  xyz[0+o*3] = suborder_xyz[2+s*4];
450  xyz[1+o*3] = suborder_xyz[0+s*4];
451  xyz[2+o*3] = suborder_xyz[3+s*4];
452  w[o] = suborder_w[s];
453  o = o + 1;
454 
455  xyz[0+o*3] = suborder_xyz[2+s*4];
456  xyz[1+o*3] = suborder_xyz[3+s*4];
457  xyz[2+o*3] = suborder_xyz[1+s*4];
458  w[o] = suborder_w[s];
459  o = o + 1;
460 
461  xyz[0+o*3] = suborder_xyz[3+s*4];
462  xyz[1+o*3] = suborder_xyz[0+s*4];
463  xyz[2+o*3] = suborder_xyz[1+s*4];
464  w[o] = suborder_w[s];
465  o = o + 1;
466 
467  xyz[0+o*3] = suborder_xyz[3+s*4];
468  xyz[1+o*3] = suborder_xyz[0+s*4];
469  xyz[2+o*3] = suborder_xyz[2+s*4];
470  w[o] = suborder_w[s];
471  o = o + 1;
472 
473  xyz[0+o*3] = suborder_xyz[3+s*4];
474  xyz[1+o*3] = suborder_xyz[2+s*4];
475  xyz[2+o*3] = suborder_xyz[0+s*4];
476  w[o] = suborder_w[s];
477  o = o + 1;
478  }
479 /*
480  24 fold symmetry on (A,B,C,D):
481 
482  123 (A,B,C)
483  124 (A,B,D)
484  132 (A,C,B)
485  134 (A,C,D)
486  142 (A,D,B)
487  143 (A,D,C)
488  213 (B,A,C)
489  214 (B,A,D)
490  231 (B,C,A)
491  234 (B,C,D)
492  241 (B,D,A)
493  243 (B,D,C)
494  312 (C,A,B)
495  314 (C,A,D)
496  321 (C,B,A)
497  324 (C,B,D)
498  341 (C,D,A)
499  342 (C,D,B)
500  412 (D,A,B)
501  413 (D,A,C)
502  421 (D,B,A)
503  423 (D,B,C)
504  431 (D,C,A)
505  432 (D,C,B)
506 */
507  else if ( suborder[s] == 24 )
508  {
509  xyz[0+o*3] = suborder_xyz[0+s*4];
510  xyz[1+o*3] = suborder_xyz[1+s*4];
511  xyz[2+o*3] = suborder_xyz[2+s*4];
512  w[o] = suborder_w[s];
513  o = o + 1;
514 
515  xyz[0+o*3] = suborder_xyz[0+s*4];
516  xyz[1+o*3] = suborder_xyz[1+s*4];
517  xyz[2+o*3] = suborder_xyz[3+s*4];
518  w[o] = suborder_w[s];
519  o = o + 1;
520 
521  xyz[0+o*3] = suborder_xyz[0+s*4];
522  xyz[1+o*3] = suborder_xyz[2+s*4];
523  xyz[2+o*3] = suborder_xyz[1+s*4];
524  w[o] = suborder_w[s];
525  o = o + 1;
526 
527  xyz[0+o*3] = suborder_xyz[0+s*4];
528  xyz[1+o*3] = suborder_xyz[2+s*4];
529  xyz[2+o*3] = suborder_xyz[3+s*4];
530  w[o] = suborder_w[s];
531  o = o + 1;
532 
533  xyz[0+o*3] = suborder_xyz[0+s*4];
534  xyz[1+o*3] = suborder_xyz[3+s*4];
535  xyz[2+o*3] = suborder_xyz[1+s*4];
536  w[o] = suborder_w[s];
537  o = o + 1;
538 
539  xyz[0+o*3] = suborder_xyz[0+s*4];
540  xyz[1+o*3] = suborder_xyz[3+s*4];
541  xyz[2+o*3] = suborder_xyz[2+s*4];
542  w[o] = suborder_w[s];
543  o = o + 1;
544 
545  xyz[0+o*3] = suborder_xyz[1+s*4];
546  xyz[1+o*3] = suborder_xyz[0+s*4];
547  xyz[2+o*3] = suborder_xyz[3+s*4];
548  w[o] = suborder_w[s];
549  o = o + 1;
550 
551  xyz[0+o*3] = suborder_xyz[1+s*4];
552  xyz[1+o*3] = suborder_xyz[0+s*4];
553  xyz[2+o*3] = suborder_xyz[4+s*4];
554  w[o] = suborder_w[s];
555  o = o + 1;
556 
557  xyz[0+o*3] = suborder_xyz[1+s*4];
558  xyz[1+o*3] = suborder_xyz[2+s*4];
559  xyz[2+o*3] = suborder_xyz[0+s*4];
560  w[o] = suborder_w[s];
561  o = o + 1;
562 
563  xyz[0+o*3] = suborder_xyz[1+s*4];
564  xyz[1+o*3] = suborder_xyz[2+s*4];
565  xyz[2+o*3] = suborder_xyz[3+s*4];
566  w[o] = suborder_w[s];
567  o = o + 1;
568 
569  xyz[0+o*3] = suborder_xyz[1+s*4];
570  xyz[1+o*3] = suborder_xyz[3+s*4];
571  xyz[2+o*3] = suborder_xyz[0+s*4];
572  w[o] = suborder_w[s];
573  o = o + 1;
574 
575  xyz[0+o*3] = suborder_xyz[1+s*4];
576  xyz[1+o*3] = suborder_xyz[3+s*4];
577  xyz[2+o*3] = suborder_xyz[2+s*4];
578  w[o] = suborder_w[s];
579  o = o + 1;
580 
581  xyz[0+o*3] = suborder_xyz[2+s*4];
582  xyz[1+o*3] = suborder_xyz[0+s*4];
583  xyz[2+o*3] = suborder_xyz[1+s*4];
584  w[o] = suborder_w[s];
585  o = o + 1;
586 
587  xyz[0+o*3] = suborder_xyz[2+s*4];
588  xyz[1+o*3] = suborder_xyz[0+s*4];
589  xyz[2+o*3] = suborder_xyz[3+s*4];
590  w[o] = suborder_w[s];
591  o = o + 1;
592 
593  xyz[0+o*3] = suborder_xyz[2+s*4];
594  xyz[1+o*3] = suborder_xyz[1+s*4];
595  xyz[2+o*3] = suborder_xyz[0+s*4];
596  w[o] = suborder_w[s];
597  o = o + 1;
598 
599  xyz[0+o*3] = suborder_xyz[2+s*4];
600  xyz[1+o*3] = suborder_xyz[1+s*4];
601  xyz[2+o*3] = suborder_xyz[3+s*4];
602  w[o] = suborder_w[s];
603  o = o + 1;
604 
605  xyz[0+o*3] = suborder_xyz[2+s*4];
606  xyz[1+o*3] = suborder_xyz[3+s*4];
607  xyz[2+o*3] = suborder_xyz[0+s*4];
608  w[o] = suborder_w[s];
609  o = o + 1;
610 
611  xyz[0+o*3] = suborder_xyz[2+s*4];
612  xyz[1+o*3] = suborder_xyz[3+s*4];
613  xyz[2+o*3] = suborder_xyz[1+s*4];
614  w[o] = suborder_w[s];
615  o = o + 1;
616 
617  xyz[0+o*3] = suborder_xyz[3+s*4];
618  xyz[1+o*3] = suborder_xyz[0+s*4];
619  xyz[2+o*3] = suborder_xyz[1+s*4];
620  w[o] = suborder_w[s];
621  o = o + 1;
622 
623  xyz[0+o*3] = suborder_xyz[3+s*4];
624  xyz[1+o*3] = suborder_xyz[0+s*4];
625  xyz[2+o*3] = suborder_xyz[2+s*4];
626  w[o] = suborder_w[s];
627  o = o + 1;
628 
629  xyz[0+o*3] = suborder_xyz[3+s*4];
630  xyz[1+o*3] = suborder_xyz[1+s*4];
631  xyz[2+o*3] = suborder_xyz[0+s*4];
632  w[o] = suborder_w[s];
633  o = o + 1;
634 
635  xyz[0+o*3] = suborder_xyz[3+s*4];
636  xyz[1+o*3] = suborder_xyz[1+s*4];
637  xyz[2+o*3] = suborder_xyz[2+s*4];
638  w[o] = suborder_w[s];
639  o = o + 1;
640 
641  xyz[0+o*3] = suborder_xyz[3+s*4];
642  xyz[1+o*3] = suborder_xyz[2+s*4];
643  xyz[2+o*3] = suborder_xyz[0+s*4];
644  w[o] = suborder_w[s];
645  o = o + 1;
646 
647  xyz[0+o*3] = suborder_xyz[3+s*4];
648  xyz[1+o*3] = suborder_xyz[2+s*4];
649  xyz[2+o*3] = suborder_xyz[1+s*4];
650  w[o] = suborder_w[s];
651  o = o + 1;
652  }
653  else
654  {
655  fprintf ( stderr, "\n" );
656  fprintf ( stderr, "TETRAHEDRON_NCO_RULE - Fatal error!\n" );
657  fprintf ( stderr, " Illegal SUBORDER(%d) = %d\n", s, suborder[s] );
658  exit ( 1 );
659  }
660  }
661 
662  free ( suborder );
663  free ( suborder_xyz );
664  free ( suborder_w );
665 
666  return;
667 }

◆ tetrahedron_nco_rule_num()

int tetrahedron_nco_rule_num ( )

Definition at line 670 of file tetrahedron_nco_rule.c.

701 {
702  int rule_num;
703 
704  rule_num = 7;
705 
706  return rule_num;
707 }

◆ tetrahedron_nco_suborder()

int* tetrahedron_nco_suborder ( int  rule,
int  suborder_num 
)

Definition at line 710 of file tetrahedron_nco_rule.c.

746 {
747  int *suborder;
748 
749  suborder = ( int * ) malloc ( suborder_num * sizeof ( int ) );
750 
751  if ( rule == 1 )
752  {
753  suborder[0] = 1;
754  }
755  else if ( rule == 2 )
756  {
757  suborder[0] = 4;
758  }
759  else if ( rule == 3 )
760  {
761  suborder[0] = 4;
762  suborder[1] = 6;
763  }
764  else if ( rule == 4 )
765  {
766  suborder[0] = 4;
767  suborder[1] = 12;
768  suborder[2] = 4;
769  }
770  else if ( rule == 5 )
771  {
772  suborder[0] = 4;
773  suborder[1] = 12;
774  suborder[2] = 6;
775  suborder[3] = 12;
776  suborder[4] = 1;
777  }
778  else if ( rule == 6 )
779  {
780  suborder[0] = 4;
781  suborder[1] = 12;
782  suborder[2] = 12;
783  suborder[3] = 12;
784  suborder[4] = 12;
785  suborder[5] = 4;
786  }
787  else if ( rule == 7 )
788  {
789  suborder[0] = 4;
790  suborder[1] = 12;
791  suborder[2] = 12;
792  suborder[3] = 12;
793  suborder[4] = 6;
794  suborder[5] = 24;
795  suborder[6] = 4;
796  suborder[7] = 4;
797  suborder[8] = 6;
798  }
799  else
800  {
801  fprintf ( stderr, "\n" );
802  fprintf ( stderr, "TETRAHEDRON_NCO_SUBORDER - Fatal error!\n" );
803  fprintf ( stderr, " Illegal RULE = %d\n", rule );
804  exit ( 1 );
805  }
806 
807  return suborder;
808 }

◆ tetrahedron_nco_suborder_num()

int tetrahedron_nco_suborder_num ( int  rule)

Definition at line 811 of file tetrahedron_nco_rule.c.

845 {
846  int suborder_num;
847 
848  if ( rule == 1 )
849  {
850  suborder_num = 1;
851  }
852  else if ( rule == 2 )
853  {
854  suborder_num = 1;
855  }
856  else if ( rule == 3 )
857  {
858  suborder_num = 2;
859  }
860  else if ( rule == 4 )
861  {
862  suborder_num = 3;
863  }
864  else if ( rule == 5 )
865  {
866  suborder_num = 5;
867  }
868  else if ( rule == 6 )
869  {
870  suborder_num = 6;
871  }
872  else if ( rule == 7 )
873  {
874  suborder_num = 9;
875  }
876  else
877  {
878  suborder_num = -1;
879  fprintf ( stderr, "\n" );
880  fprintf ( stderr, "TETRAHEDRON_NCO_SUBORDER_NUM - Fatal error!\n" );
881  fprintf ( stderr, " Illegal RULE = %d\n", rule );
882  exit ( 1 );
883  }
884 
885  return suborder_num;
886 }

◆ tetrahedron_nco_subrule()

void tetrahedron_nco_subrule ( int  rule,
int  suborder_num,
double  suborder_xyz[],
double  suborder_w[] 
)

Definition at line 889 of file tetrahedron_nco_rule.c.

928 {
929  int i;
930  int s;
931  int suborder_w_d;
932  int *suborder_w_n;
933  int suborder_xyz_d;
934  int *suborder_xyz_n;
935 
936  suborder_xyz_n = ( int * ) malloc ( 4 * suborder_num * sizeof ( int ) );
937  suborder_w_n = ( int * ) malloc ( suborder_num * sizeof ( int ) );
938 
939  if ( rule == 1 )
940  {
941  tetrahedron_nco_subrule_01 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
942  suborder_w_n, &suborder_w_d );
943  }
944  else if ( rule == 2 )
945  {
946  tetrahedron_nco_subrule_02 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
947  suborder_w_n, &suborder_w_d );
948  }
949  else if ( rule == 3 )
950  {
951  tetrahedron_nco_subrule_03 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
952  suborder_w_n, &suborder_w_d );
953  }
954  else if ( rule == 4 )
955  {
956  tetrahedron_nco_subrule_04 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
957  suborder_w_n, &suborder_w_d );
958  }
959  else if ( rule == 5 )
960  {
961  tetrahedron_nco_subrule_05 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
962  suborder_w_n, &suborder_w_d );
963  }
964  else if ( rule == 6 )
965  {
966  tetrahedron_nco_subrule_06 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
967  suborder_w_n, &suborder_w_d );
968  }
969  else if ( rule == 7 )
970  {
971  tetrahedron_nco_subrule_07 ( suborder_num, suborder_xyz_n, &suborder_xyz_d,
972  suborder_w_n, &suborder_w_d );
973  }
974  else
975  {
976  fprintf ( stderr, "\n" );
977  fprintf ( stderr, "TETRAHEDRON_NCO_SUBRULE - Fatal error!\n" );
978  fprintf ( stderr, " Illegal RULE = %d\n", rule );
979  exit ( 1 );
980  }
981 
982  for ( s = 0; s < suborder_num; s++ )
983  {
984  for ( i = 0; i < 4; i++ )
985  {
986  suborder_xyz[i+s*4] =
987  ( double ) ( 1 + suborder_xyz_n[i+s*4] )
988  / ( double ) ( 4 + suborder_xyz_d );
989  }
990  }
991  for ( s = 0; s < suborder_num; s++ )
992  {
993  suborder_w[s] = ( double ) suborder_w_n[s] / ( double ) suborder_w_d;
994  }
995 
996  free ( suborder_w_n );
997  free ( suborder_xyz_n );
998 
999  return;
1000 }

◆ tetrahedron_nco_subrule_01()

void tetrahedron_nco_subrule_01 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1003 of file tetrahedron_nco_rule.c.

1047 {
1048  int i;
1049  int s;
1050  int suborder_xyz_n_01[4*1] = {
1051  0, 0, 0, 0
1052  };
1053  int suborder_xyz_d_01 = 0;
1054  int suborder_w_n_01[1] = { 1 };
1055  int suborder_w_d_01 = 1;
1056 
1057  for ( s = 0; s < suborder_num; s++ )
1058  {
1059  for ( i = 0; i < 4; i++ )
1060  {
1061  suborder_xyz_n[i+s*4] = suborder_xyz_n_01[i+s*4];
1062  }
1063  }
1064  *suborder_xyz_d = suborder_xyz_d_01;
1065 
1066  for ( s = 0; s < suborder_num; s++ )
1067  {
1068  suborder_w_n[s] = suborder_w_n_01[s];
1069  }
1070  *suborder_w_d = suborder_w_d_01;
1071 
1072  return;
1073 }

◆ tetrahedron_nco_subrule_02()

void tetrahedron_nco_subrule_02 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1076 of file tetrahedron_nco_rule.c.

1120 {
1121  int i;
1122  int s;
1123  int suborder_xyz_n_02[4*1] = {
1124  0, 0, 0, 1
1125  };
1126  int suborder_xyz_d_02 = 1;
1127  int suborder_w_n_02[1] = { 1 };
1128  int suborder_w_d_02 = 4;
1129 
1130  for ( s = 0; s < suborder_num; s++ )
1131  {
1132  for ( i = 0; i < 4; i++ )
1133  {
1134  suborder_xyz_n[i+s*4] = suborder_xyz_n_02[i+s*4];
1135  }
1136  }
1137  *suborder_xyz_d = suborder_xyz_d_02;
1138 
1139  for ( s = 0; s < suborder_num; s++ )
1140  {
1141  suborder_w_n[s] = suborder_w_n_02[s];
1142  }
1143  *suborder_w_d = suborder_w_d_02;
1144 
1145  return;
1146 }

◆ tetrahedron_nco_subrule_03()

void tetrahedron_nco_subrule_03 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1149 of file tetrahedron_nco_rule.c.

1193 {
1194  int i;
1195  int s;
1196  int suborder_xyz_n_03[4*2] = {
1197  0, 0, 0, 2,
1198  1, 1, 0, 0
1199  };
1200  int suborder_xyz_d_03 = 2;
1201  int suborder_w_n_03[2] = { 11, -4 };
1202  int suborder_w_d_03 = 20;
1203 
1204  for ( s = 0; s < suborder_num; s++ )
1205  {
1206  for ( i = 0; i < 4; i++ )
1207  {
1208  suborder_xyz_n[i+s*4] = suborder_xyz_n_03[i+s*4];
1209  }
1210  }
1211  *suborder_xyz_d = suborder_xyz_d_03;
1212 
1213  for ( s = 0; s < suborder_num; s++ )
1214  {
1215  suborder_w_n[s] = suborder_w_n_03[s];
1216  }
1217  *suborder_w_d = suborder_w_d_03;
1218 
1219  return;
1220 }

◆ tetrahedron_nco_subrule_04()

void tetrahedron_nco_subrule_04 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1223 of file tetrahedron_nco_rule.c.

1267 {
1268  int i;
1269  int s;
1270  int suborder_xyz_n_04[4*3] = {
1271  0, 0, 0, 3,
1272  0, 0, 1, 2,
1273  1, 1, 1, 0
1274  };
1275  int suborder_xyz_d_04 = 3;
1276  int suborder_w_n_04[3] = { 20, 13, -29 };
1277  int suborder_w_d_04 = 120;
1278 
1279  for ( s = 0; s < suborder_num; s++ )
1280  {
1281  for ( i = 0; i < 4; i++ )
1282  {
1283  suborder_xyz_n[i+s*4] = suborder_xyz_n_04[i+s*4];
1284  }
1285  }
1286  *suborder_xyz_d = suborder_xyz_d_04;
1287 
1288  for ( s = 0; s < suborder_num; s++ )
1289  {
1290  suborder_w_n[s] = suborder_w_n_04[s];
1291  }
1292  *suborder_w_d = suborder_w_d_04;
1293 
1294  return;
1295 }

◆ tetrahedron_nco_subrule_05()

void tetrahedron_nco_subrule_05 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1298 of file tetrahedron_nco_rule.c.

1342 {
1343  int i;
1344  int s;
1345  int suborder_xyz_n_05[4*5] = {
1346  0, 0, 0, 4,
1347  0, 0, 3, 1,
1348  2, 2, 0, 0,
1349  1, 1, 0, 2,
1350  1, 1, 1, 1
1351  };
1352  int suborder_xyz_d_05 = 4;
1353  int suborder_w_n_05[5] = { 79, -68, 142, -12, 2 };
1354  int suborder_w_d_05 = 210;
1355 
1356  for ( s = 0; s < suborder_num; s++ )
1357  {
1358  for ( i = 0; i < 4; i++ )
1359  {
1360  suborder_xyz_n[i+s*4] = suborder_xyz_n_05[i+s*4];
1361  }
1362  }
1363  *suborder_xyz_d = suborder_xyz_d_05;
1364 
1365  for ( s = 0; s < suborder_num; s++ )
1366  {
1367  suborder_w_n[s] = suborder_w_n_05[s];
1368  }
1369  *suborder_w_d = suborder_w_d_05;
1370 
1371  return;
1372 }

◆ tetrahedron_nco_subrule_06()

void tetrahedron_nco_subrule_06 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1375 of file tetrahedron_nco_rule.c.

1419 {
1420  int i;
1421  int s;
1422  int suborder_xyz_n_06[4*6] = {
1423  0, 0, 0, 5,
1424  0, 0, 4, 1,
1425  0, 0, 3, 2,
1426  1, 1, 0, 3,
1427  2, 2, 1, 0,
1428  1, 1, 1, 2
1429  };
1430  int suborder_xyz_d_06 = 5;
1431  int suborder_w_n_06[6] = { 277, 97, 223, -713, 505, -53 };
1432  int suborder_w_d_06 = 2240;
1433 
1434  for ( s = 0; s < suborder_num; s++ )
1435  {
1436  for ( i = 0; i < 4; i++ )
1437  {
1438  suborder_xyz_n[i+s*4] = suborder_xyz_n_06[i+s*4];
1439  }
1440  }
1441  *suborder_xyz_d = suborder_xyz_d_06;
1442 
1443  for ( s = 0; s < suborder_num; s++ )
1444  {
1445  suborder_w_n[s] = suborder_w_n_06[s];
1446  }
1447  *suborder_w_d = suborder_w_d_06;
1448 
1449  return;
1450 }

◆ tetrahedron_nco_subrule_07()

void tetrahedron_nco_subrule_07 ( int  suborder_num,
int  suborder_xyz_n[],
int *  suborder_xyz_d,
int  suborder_w_n[],
int *  suborder_w_d 
)

Definition at line 1453 of file tetrahedron_nco_rule.c.

1497 {
1498  int i;
1499  int s;
1500  int suborder_xyz_n_07[4*9] = {
1501  0, 0, 0, 6,
1502  0, 0, 5, 1,
1503  0, 0, 4, 2,
1504  1, 1, 0, 4,
1505  3, 3, 0, 0,
1506  3, 2, 1, 0,
1507  1, 1, 1, 3,
1508  2, 2, 2, 0,
1509  2, 2, 1, 1
1510  };
1511  int suborder_xyz_d_07 = 6;
1512  int suborder_w_n_07[9] = { 430, -587, 1327, 187, -1298, -398, 22, 1537, -38 };
1513  int suborder_w_d_07 = 1512;
1514 
1515  for ( s = 0; s < suborder_num; s++ )
1516  {
1517  for ( i = 0; i < 4; i++ )
1518  {
1519  suborder_xyz_n[i+s*4] = suborder_xyz_n_07[i+s*4];
1520  }
1521  }
1522  *suborder_xyz_d = suborder_xyz_d_07;
1523 
1524  for ( s = 0; s < suborder_num; s++ )
1525  {
1526  suborder_w_n[s] = suborder_w_n_07[s];
1527  }
1528  *suborder_w_d = suborder_w_d_07;
1529 
1530  return;
1531 }

◆ tetrahedron_volume()

double tetrahedron_volume ( double  tetra[3 *4])

Definition at line 1534 of file tetrahedron_nco_rule.c.

1560 {
1561  double a[4*4];
1562  int i;
1563  int j;
1564  double volume;
1565 
1566  for ( i = 0; i < 3; i++ )
1567  {
1568  for ( j = 0; j < 4; j++ )
1569  {
1570  a[i+j*4] = tetra[i+j*3];
1571  }
1572  }
1573 
1574  i = 3;
1575  for ( j = 0; j < 4; j++ )
1576  {
1577  a[i+j*4] = 1.0;
1578  }
1579 
1580  volume = fabs ( r8mat_det_4d ( a ) ) / 6.0;
1581 
1582  return volume;
1583 }
tetrahedron_nco_subrule_03
void tetrahedron_nco_subrule_03(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1149
tetrahedron_nco_subrule_05
void tetrahedron_nco_subrule_05(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1298
r8mat_det_4d
double r8mat_det_4d(double a[])
Definition: tetrahedron_nco_rule.c:6
tetrahedron_nco_suborder_num
int tetrahedron_nco_suborder_num(int rule)
Definition: tetrahedron_nco_rule.c:811
tetrahedron_nco_subrule
void tetrahedron_nco_subrule(int rule, int suborder_num, double suborder_xyz[], double suborder_w[])
Definition: tetrahedron_nco_rule.c:889
order
constexpr int order
Definition: dg_projection.cpp:18
a
constexpr double a
Definition: approx_sphere.cpp:30
tetrahedron_nco_subrule_06
void tetrahedron_nco_subrule_06(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1375
double
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
tetrahedron_nco_subrule_04
void tetrahedron_nco_subrule_04(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1223
convert.n
n
Definition: convert.py:82
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
tetrahedron_nco_suborder
int * tetrahedron_nco_suborder(int rule, int suborder_num)
Definition: tetrahedron_nco_rule.c:710
sdf_wavy_2d.w
int w
Definition: sdf_wavy_2d.py:6
tetrahedron_nco_subrule_01
void tetrahedron_nco_subrule_01(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1003
tetrahedron_nco_subrule_02
void tetrahedron_nco_subrule_02(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1076
tetrahedron_nco_subrule_07
void tetrahedron_nco_subrule_07(int suborder_num, int suborder_xyz_n[], int *suborder_xyz_d, int suborder_w_n[], int *suborder_w_d)
Definition: tetrahedron_nco_rule.c:1453