v0.14.0
Loading...
Searching...
No Matches
triangle_felippa_rule.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <std::string.h>
#include <math.h>
#include "triangle_felippa_rule.h"

Go to the source code of this file.

Functions

void comp_next (int n, int k, int a[], int *more, int *h, int *t)
 
doublemonomial_value (int m, int n, int e[], double x[])
 
void r8vec_copy (int n, double a1[], double a2[])
 
double r8vec_dot_product (int n, double a1[], double a2[])
 
void subcomp_next (int n, int k, int a[], int *more, int *h, int *t)
 
double triangle_unit_monomial (int expon[2])
 
void triangle_unit_o01 (double w[], double xy[])
 
void triangle_unit_o03 (double w[], double xy[])
 
void triangle_unit_o03b (double w[], double xy[])
 
void triangle_unit_o06 (double w[], double xy[])
 
void triangle_unit_o06b (double w[], double xy[])
 
void triangle_unit_o07 (double w[], double xy[])
 
void triangle_unit_o12 (double w[], double xy[])
 
double triangle_unit_volume ()
 

Function Documentation

◆ comp_next()

void comp_next ( int n,
int k,
int a[],
int * more,
int * h,
int * t )

Definition at line 11 of file triangle_felippa_rule.c.

121{
122 int i;
123
124 if ( !( *more ) )
125 {
126 *t = n;
127 *h = 0;
128 a[0] = n;
129 for ( i = 1; i < k; i++ )
130 {
131 a[i] = 0;
132 }
133 }
134 else
135 {
136 if ( 1 < *t )
137 {
138 *h = 0;
139 }
140 *h = *h + 1;
141 *t = a[*h-1];
142 a[*h-1] = 0;
143 a[0] = *t - 1;
144 a[*h] = a[*h] + 1;
145 }
146
147 *more = ( a[k-1] != n );
148
149 return;
150}
constexpr double a
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
FTensor::Index< 'k', 3 > k
double h
constexpr double t
plate stiffness
Definition plate.cpp:58

◆ monomial_value()

double * monomial_value ( int m,
int n,
int e[],
double x[] )

Definition at line 153 of file triangle_felippa_rule.c.

193{
194 int i;
195 int j;
196 double *v;
197
198 v = ( double * ) malloc ( n * sizeof ( double ) );
199
200 for ( j = 0; j < n; j++ )
201 {
202 v[j] = 1.0;
203 }
204
205 for ( i = 0; i < m; i++ )
206 {
207 if ( 0 != e[i] )
208 {
209 for ( j = 0; j < n; j++ )
210 {
211 v[j] = v[j] * pow ( x[i+j*m], e[i] );
212 }
213 }
214 }
215
216 return v;
217}
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'j', 3 > j
FTensor::Index< 'm', 3 > m

◆ r8vec_copy()

void r8vec_copy ( int n,
double a1[],
double a2[] )

Definition at line 220 of file triangle_felippa_rule.c.

252{
253 int i;
254
255 for ( i = 0; i < n; i++ )
256 {
257 a2[i] = a1[i];
258 }
259 return;
260}
constexpr double a2
constexpr double a1

◆ r8vec_dot_product()

double r8vec_dot_product ( int n,
double a1[],
double a2[] )

Definition at line 263 of file triangle_felippa_rule.c.

291{
292 int i;
293 double value;
294
295 value = 0.0;
296 for ( i = 0; i < n; i++ )
297 {
298 value = value + a1[i] * a2[i];
299 }
300 return value;
301}

◆ subcomp_next()

void subcomp_next ( int n,
int k,
int a[],
int * more,
int * h,
int * t )

Definition at line 304 of file triangle_felippa_rule.c.

357{
358 int i;
359 static int more2 = 0;
360 static int n2 = 0;
361/*
362 The first computation.
363*/
364 if ( !( *more ) )
365 {
366 n2 = 0;
367
368 for ( i = 0; i < k; i++ )
369 {
370 a[i] = 0;
371 }
372 more2 = 0;
373 *h = 0;
374 *t = 0;
375
376 *more = 1;
377 }
378/*
379 Do the next element at the current value of N.
380*/
381 else if ( more2 )
382 {
383 comp_next ( n2, k, a, &more2, h, t );
384 }
385 else
386 {
387 more2 = 0;
388 n2 = n2 + 1;
389
390 comp_next ( n2, k, a, &more2, h, t );
391 }
392/*
393 Termination occurs if MORE2 = FALSE and N2 = N.
394*/
395 if ( !more2 && n2 == n )
396 {
397 *more = 0;
398 }
399
400 return;
401}
void comp_next(int n, int k, int a[], int *more, int *h, int *t)

◆ triangle_unit_monomial()

double triangle_unit_monomial ( int expon[2])

Definition at line 453 of file triangle_felippa_rule.c.

497{
498 int i;
499 int k;
500 double value;
501/*
502 The first computation ends with VALUE = 1.0;
503*/
504 value = 1.0;
505
506/* k = 0;
507
508 The first loop simply computes 1 so we short circuit it!
509
510 for ( i = 1; i <= expon[0]; i++ )
511 {
512 k = k + 1;
513 value = value * ( double ) ( i ) / ( double ) ( k );
514 }*/
515
516 k = expon[0];
517
518 for ( i = 1; i <= expon[1]; i++ )
519 {
520 k = k + 1;
521 value = value * ( double ) ( i ) / ( double ) ( k );
522 }
523
524 k = k + 1;
525 value = value / ( double ) ( k );
526
527 k = k + 1;
528 value = value / ( double ) ( k );
529
530 return value;
531}

◆ triangle_unit_o01()

void triangle_unit_o01 ( double w[],
double xy[] )

Definition at line 534 of file triangle_felippa_rule.c.

577{
578 int order = 1;
579
580 double w_save[1] = {
581 1.0 };
582 double xy_save[2*1] = {
583 0.33333333333333333333, 0.33333333333333333333 };
584
585 r8vec_copy ( order, w_save, w );
586 r8vec_copy ( 2*order, xy_save, xy );
587
588 return;
589}
constexpr int order
void r8vec_copy(int n, double a1[], double a2[])

◆ triangle_unit_o03()

void triangle_unit_o03 ( double w[],
double xy[] )

Definition at line 592 of file triangle_felippa_rule.c.

635{
636 int order = 3;
637
638 double w_save[3] = {
639 0.33333333333333333333,
640 0.33333333333333333333,
641 0.33333333333333333333 };
642 double xy_save[2*3] = {
643 0.66666666666666666667, 0.16666666666666666667,
644 0.16666666666666666667, 0.66666666666666666667,
645 0.16666666666666666667, 0.16666666666666666667 };
646
647 r8vec_copy ( order, w_save, w );
648 r8vec_copy ( 2*order, xy_save, xy );
649
650 return;
651}

◆ triangle_unit_o03b()

void triangle_unit_o03b ( double w[],
double xy[] )

Definition at line 654 of file triangle_felippa_rule.c.

697{
698 int order = 3;
699
700 double w_save[3] = {
701 0.33333333333333333333,
702 0.33333333333333333333,
703 0.33333333333333333333 };
704 double xy_save[2*3] = {
705 0.0, 0.5,
706 0.5, 0.0,
707 0.5, 0.5 };
708
709 r8vec_copy ( order, w_save, w );
710 r8vec_copy ( 2*order, xy_save, xy );
711
712 return;
713}

◆ triangle_unit_o06()

void triangle_unit_o06 ( double w[],
double xy[] )

Definition at line 716 of file triangle_felippa_rule.c.

759{
760 int order = 6;
761
762 double w_save[6] = {
763 0.22338158967801146570,
764 0.22338158967801146570,
765 0.22338158967801146570,
766 0.10995174365532186764,
767 0.10995174365532186764,
768 0.10995174365532186764 };
769 double xy_save[2*6] = {
770 0.10810301816807022736, 0.44594849091596488632,
771 0.44594849091596488632, 0.10810301816807022736,
772 0.44594849091596488632, 0.44594849091596488632,
773 0.81684757298045851308, 0.091576213509770743460,
774 0.091576213509770743460, 0.81684757298045851308,
775 0.091576213509770743460, 0.091576213509770743460 };
776
777 r8vec_copy ( order, w_save, w );
778 r8vec_copy ( 2*order, xy_save, xy );
779
780 return;
781}

◆ triangle_unit_o06b()

void triangle_unit_o06b ( double w[],
double xy[] )

Definition at line 784 of file triangle_felippa_rule.c.

827{
828 int order = 6;
829
830 double w_save[6] = {
831 0.30000000000000000000,
832 0.30000000000000000000,
833 0.30000000000000000000,
834 0.033333333333333333333,
835 0.033333333333333333333,
836 0.033333333333333333333 };
837 double xy_save[2*6] = {
838 0.66666666666666666667, 0.16666666666666666667,
839 0.16666666666666666667, 0.66666666666666666667,
840 0.16666666666666666667, 0.16666666666666666667,
841 0.0, 0.5,
842 0.5, 0.0,
843 0.5, 0.5 };
844
845 r8vec_copy ( order, w_save, w );
846 r8vec_copy ( 2*order, xy_save, xy );
847
848 return;
849}

◆ triangle_unit_o07()

void triangle_unit_o07 ( double w[],
double xy[] )

Definition at line 852 of file triangle_felippa_rule.c.

895{
896 int order = 7;
897
898 double w_save[7] = {
899 0.12593918054482715260,
900 0.12593918054482715260,
901 0.12593918054482715260,
902 0.13239415278850618074,
903 0.13239415278850618074,
904 0.13239415278850618074,
905 0.22500000000000000000 };
906 double xy_save[2*7] = {
907 0.79742698535308732240, 0.10128650732345633880,
908 0.10128650732345633880, 0.79742698535308732240,
909 0.10128650732345633880, 0.10128650732345633880,
910 0.059715871789769820459, 0.47014206410511508977,
911 0.47014206410511508977, 0.059715871789769820459,
912 0.47014206410511508977, 0.47014206410511508977,
913 0.33333333333333333333, 0.33333333333333333333 };
914
915 r8vec_copy ( order, w_save, w );
916 r8vec_copy ( 2*order, xy_save, xy );
917
918 return;
919}

◆ triangle_unit_o12()

void triangle_unit_o12 ( double w[],
double xy[] )

Definition at line 922 of file triangle_felippa_rule.c.

965{
966 int order = 12;
967
968 double w_save[12] = {
969 0.050844906370206816921,
970 0.050844906370206816921,
971 0.050844906370206816921,
972 0.11678627572637936603,
973 0.11678627572637936603,
974 0.11678627572637936603,
975 0.082851075618373575194,
976 0.082851075618373575194,
977 0.082851075618373575194,
978 0.082851075618373575194,
979 0.082851075618373575194,
980 0.082851075618373575194 };
981 double xy_save[2*12] = {
982 0.87382197101699554332, 0.063089014491502228340,
983 0.063089014491502228340, 0.87382197101699554332,
984 0.063089014491502228340, 0.063089014491502228340,
985 0.50142650965817915742, 0.24928674517091042129,
986 0.24928674517091042129, 0.50142650965817915742,
987 0.24928674517091042129, 0.24928674517091042129,
988 0.053145049844816947353, 0.31035245103378440542,
989 0.31035245103378440542, 0.053145049844816947353,
990 0.053145049844816947353, 0.63650249912139864723,
991 0.31035245103378440542, 0.63650249912139864723,
992 0.63650249912139864723, 0.053145049844816947353,
993 0.63650249912139864723, 0.31035245103378440542 };
994
995 r8vec_copy ( order, w_save, w );
996 r8vec_copy ( 2*order, xy_save, xy );
997
998 return;
999}

◆ triangle_unit_volume()

double triangle_unit_volume ( )

Definition at line 1002 of file triangle_felippa_rule.c.

1036{
1037 double volume;
1038
1039 volume = 1.0 / 2.0;
1040
1041 return volume;
1042}