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

/******************************************************************************/
/*
  Purpose:

    TRIANGLE_O03B returns a 3 point quadrature rule for the unit triangle.

  Discussion:

    This rule is precise for monomials through degree 2.

    The integration region is:

      0 <= X
      0 <= Y
      X + Y <= 1.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    16 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[3], the weights.

    Output, double XY[2*3], the abscissas.
*/
{
  int order = 3;

  double w_save[3] = {
    0.33333333333333333333,
    0.33333333333333333333,
    0.33333333333333333333 };
  double xy_save[2*3] = {
    0.0,  0.5,
    0.5,  0.0,
    0.5,  0.5 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 2*order, xy_save, xy );

  return;
}
void pyramid_unit_o01 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O01 returns a 1 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[1], the weights.

    Output, double XYZ[3*1], the abscissas.
*/
{
  int order = 1;

  double w_save[1] = { 1.0 };

  double xyz_save[3*1] = { 0.00, 0.00, 0.25 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void line_o04 ( double w[], double x[] )

/******************************************************************************/
/*
  Purpose:

    LINE_O04 returns a 4 point quadrature rule for the unit line.

  Discussion:

    The integration region is:

    - 1.0 <= X <= 1.0

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[4], the weights.

    Output, double X[4], the abscissas.
*/
{
  int i;
  int order = 4;
  double w_save[4] = {
    0.173927422568727, 
    0.326072577431273, 
    0.326072577431273, 
    0.173927422568727 };
  double x_save[4] = {
    -0.86113631159405257522,
    -0.33998104358485626480,
     0.33998104358485626480,
     0.86113631159405257522 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( order, x_save, x );

  return;
}
void line_o03 ( double w[], double x[] )

/******************************************************************************/
/*
  Purpose:

    LINE_O03 returns a 3 point quadrature rule for the unit line.

  Discussion:

    The integration region is:

    - 1.0 <= X <= 1.0

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[3], the weights.

    Output, double X[3], the abscissas.
*/
{
  int i;
  int order = 3;
  double w_save[3] = {
    0.27777777777777777777, 
    0.44444444444444444444, 
    0.27777777777777777777  };
  double x_save[3] = {
    -0.77459666924148337704,
     0.00000000000000000000,
     0.77459666924148337704 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( order, x_save, x );

  return;
}
void line_o02 ( double w[], double x[] )

/******************************************************************************/
/*
  Purpose:

    LINE_O02 returns a 2 point quadrature rule for the unit line.

  Discussion:

    The integration region is:

    - 1.0 <= X <= 1.0

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[2], the weights.

    Output, double X[2], the abscissas.
*/
{
  int i;
  int order = 2;
  double w_save[2] = {
    0.5,
    0.5 };
  double x_save[2] = {
    -0.57735026918962576451,
     0.57735026918962576451 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( order, x_save, x );

  return;
}
void triangle_o12 ( double w[], double xy[] )

/******************************************************************************/
/*
  Purpose:

    TRIANGLE_O12 returns a 12 point quadrature rule for the unit triangle.

  Discussion:

    This rule is precise for monomials through degree 6.

    The integration region is:

      0 <= X
      0 <= Y
      X + Y <= 1.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    19 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[12], the weights.

    Output, double XY[2*12], the abscissas.
*/
{
  int order = 12;

  double w_save[12] = {
     0.050844906370206816921,
     0.050844906370206816921,
     0.050844906370206816921,
     0.11678627572637936603,
     0.11678627572637936603,
     0.11678627572637936603,
     0.082851075618373575194,
     0.082851075618373575194,
     0.082851075618373575194,
     0.082851075618373575194,
     0.082851075618373575194,
     0.082851075618373575194 };
  double xy_save[2*12] = {
    0.87382197101699554332,  0.063089014491502228340,
    0.063089014491502228340,  0.87382197101699554332,
    0.063089014491502228340,  0.063089014491502228340,
    0.50142650965817915742,  0.24928674517091042129,
    0.24928674517091042129,  0.50142650965817915742,
    0.24928674517091042129,  0.24928674517091042129,
    0.053145049844816947353,  0.31035245103378440542,
    0.31035245103378440542,  0.053145049844816947353,
    0.053145049844816947353,  0.63650249912139864723,
    0.31035245103378440542,  0.63650249912139864723,
    0.63650249912139864723,  0.053145049844816947353,
    0.63650249912139864723,  0.31035245103378440542 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 2*order, xy_save, xy );

  return;
}
void triangle_o07 ( double w[], double xy[] )

/******************************************************************************/
/*
  Purpose:

    TRIANGLE_O07 returns a 7 point quadrature rule for the unit triangle.

  Discussion:

    This rule is precise for monomials through degree 5.

    The integration region is:

      0 <= X
      0 <= Y
      X + Y <= 1.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    16 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[7], the weights.

    Output, double XY[2*7], the abscissas.
*/
{
  int order = 7;

  double w_save[7] = {
    0.12593918054482715260,
    0.12593918054482715260,
    0.12593918054482715260,
    0.13239415278850618074,
    0.13239415278850618074,
    0.13239415278850618074,
    0.22500000000000000000 };
  double xy_save[2*7] = {
    0.79742698535308732240,  0.10128650732345633880,
    0.10128650732345633880,  0.79742698535308732240,
    0.10128650732345633880,  0.10128650732345633880,
    0.059715871789769820459,  0.47014206410511508977,
    0.47014206410511508977,  0.059715871789769820459,
    0.47014206410511508977,  0.47014206410511508977,
    0.33333333333333333333,  0.33333333333333333333 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 2*order, xy_save, xy );

  return;
}
void triangle_o06 ( double w[], double xy[] )

/******************************************************************************/
/*
  Purpose:

    TRIANGLE_O06 returns a 6 point quadrature rule for the unit triangle.

  Discussion:

    This rule is precise for monomials through degree 4.

    The integration region is:

      0 <= X
      0 <= Y
      X + Y <= 1.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    16 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[6], the weights.

    Output, double XY[2*6], the abscissas.
*/
{
  int order = 6;

  double w_save[6] = {
    0.22338158967801146570,
    0.22338158967801146570,
    0.22338158967801146570,
    0.10995174365532186764,
    0.10995174365532186764,
    0.10995174365532186764 };
  double xy_save[2*6] = {
    0.10810301816807022736,  0.44594849091596488632,
    0.44594849091596488632,  0.10810301816807022736,
    0.44594849091596488632,  0.44594849091596488632,
    0.81684757298045851308,  0.091576213509770743460,
    0.091576213509770743460,  0.81684757298045851308,
    0.091576213509770743460,  0.091576213509770743460 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 2*order, xy_save, xy );

  return;
}
void pyramid_unit_o48 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O48 returns a 48 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[48], the weights.

    Output, double XYZ[3*48], the abscissas.
*/
{
  int order = 48;

  double w_save[48] = {
  2.01241939442682455E-002,
  2.01241939442682455E-002,
  2.01241939442682455E-002,
  2.01241939442682455E-002,
  2.60351137043010779E-002,
  2.60351137043010779E-002,
  2.60351137043010779E-002,
  2.60351137043010779E-002,
  1.24557795239745531E-002,
  1.24557795239745531E-002,
  1.24557795239745531E-002,
  1.24557795239745531E-002,
  1.87873998794808156E-003,
  1.87873998794808156E-003,
  1.87873998794808156E-003,
  1.87873998794808156E-003,
  4.32957927807745280E-002,
  4.32957927807745280E-002,
  4.32957927807745280E-002,
  4.32957927807745280E-002,
  1.97463249834127288E-002,
  1.97463249834127288E-002,
  1.97463249834127288E-002,
  1.97463249834127288E-002,
  5.60127223523590526E-002,
  5.60127223523590526E-002,
  5.60127223523590526E-002,
  5.60127223523590526E-002,
  2.55462562927473852E-002,
  2.55462562927473852E-002,
  2.55462562927473852E-002,
  2.55462562927473852E-002,
  2.67977366291788643E-002,
  2.67977366291788643E-002,
  2.67977366291788643E-002,
  2.67977366291788643E-002,
  1.22218992265373354E-002,
  1.22218992265373354E-002,
  1.22218992265373354E-002,
  1.22218992265373354E-002,
  4.04197740453215038E-003,
  4.04197740453215038E-003,
  4.04197740453215038E-003,
  4.04197740453215038E-003,
  1.84346316995826843E-003,
  1.84346316995826843E-003,
  1.84346316995826843E-003,
  1.84346316995826843E-003 };

  double xyz_save[3*48] = {
  0.88091731624450909E+00,  0.00000000000000000E+00,  4.85005494469969989E-02,
 -0.88091731624450909E+00,  0.00000000000000000E+00,  4.85005494469969989E-02,
  0.00000000000000000E+00,  0.88091731624450909E+00,  4.85005494469969989E-02,
  0.00000000000000000E+00, -0.88091731624450909E+00,  4.85005494469969989E-02,
  0.70491874112648223E+00,  0.00000000000000000E+00,  0.23860073755186201E+00,
 -0.70491874112648223E+00,  0.00000000000000000E+00,  0.23860073755186201E+00,
  0.00000000000000000E+00,  0.70491874112648223E+00,  0.23860073755186201E+00,
  0.00000000000000000E+00, -0.70491874112648223E+00,  0.23860073755186201E+00,
  0.44712732143189760E+00,  0.00000000000000000E+00,  0.51704729510436798E+00,
 -0.44712732143189760E+00,  0.00000000000000000E+00,  0.51704729510436798E+00,
  0.00000000000000000E+00,  0.44712732143189760E+00,  0.51704729510436798E+00,
  0.00000000000000000E+00, -0.44712732143189760E+00,  0.51704729510436798E+00,
  0.18900486065123448E+00,  0.00000000000000000E+00,  0.79585141789677305E+00,
 -0.18900486065123448E+00,  0.00000000000000000E+00,  0.79585141789677305E+00,
  0.00000000000000000E+00,  0.18900486065123448E+00,  0.79585141789677305E+00,
  0.00000000000000000E+00, -0.18900486065123448E+00,  0.79585141789677305E+00,
  0.36209733410322176E+00,  0.36209733410322176E+00,  4.85005494469969989E-02,
 -0.36209733410322176E+00,  0.36209733410322176E+00,  4.85005494469969989E-02,
 -0.36209733410322176E+00, -0.36209733410322176E+00,  4.85005494469969989E-02,
  0.36209733410322176E+00, -0.36209733410322176E+00,  4.85005494469969989E-02,
  0.76688932060387538E+00,  0.76688932060387538E+00,  4.85005494469969989E-02,
 -0.76688932060387538E+00,  0.76688932060387538E+00,  4.85005494469969989E-02,
 -0.76688932060387538E+00, -0.76688932060387538E+00,  4.85005494469969989E-02,
  0.76688932060387538E+00, -0.76688932060387538E+00,  4.85005494469969989E-02,
  0.28975386476618070E+00,  0.28975386476618070E+00,  0.23860073755186201E+00,
 -0.28975386476618070E+00,  0.28975386476618070E+00,  0.23860073755186201E+00,
 -0.28975386476618070E+00, -0.28975386476618070E+00,  0.23860073755186201E+00,
  0.28975386476618070E+00, -0.28975386476618070E+00,  0.23860073755186201E+00,
  0.61367241226233160E+00,  0.61367241226233160E+00,  0.23860073755186201E+00,
 -0.61367241226233160E+00,  0.61367241226233160E+00,  0.23860073755186201E+00,
 -0.61367241226233160E+00, -0.61367241226233160E+00,  0.23860073755186201E+00,
  0.61367241226233160E+00, -0.61367241226233160E+00,  0.23860073755186201E+00,
  0.18378979287798017E+00,  0.18378979287798017E+00,  0.51704729510436798E+00,
 -0.18378979287798017E+00,  0.18378979287798017E+00,  0.51704729510436798E+00,
 -0.18378979287798017E+00, -0.18378979287798017E+00,  0.51704729510436798E+00,
  0.18378979287798017E+00, -0.18378979287798017E+00,  0.51704729510436798E+00,
  0.38925011625173161E+00,  0.38925011625173161E+00,  0.51704729510436798E+00,
 -0.38925011625173161E+00,  0.38925011625173161E+00,  0.51704729510436798E+00,
 -0.38925011625173161E+00, -0.38925011625173161E+00,  0.51704729510436798E+00,
  0.38925011625173161E+00, -0.38925011625173161E+00,  0.51704729510436798E+00,
  7.76896479525748113E-02,  7.76896479525748113E-02,  0.79585141789677305E+00,
 -7.76896479525748113E-02,  7.76896479525748113E-02,  0.79585141789677305E+00,
 -7.76896479525748113E-02, -7.76896479525748113E-02,  0.79585141789677305E+00,
  7.76896479525748113E-02, -7.76896479525748113E-02,  0.79585141789677305E+00,
  0.16453962988669860E+00,  0.16453962988669860E+00,  0.79585141789677305E+00,
 -0.16453962988669860E+00,  0.16453962988669860E+00,  0.79585141789677305E+00,
 -0.16453962988669860E+00, -0.16453962988669860E+00,  0.79585141789677305E+00,
  0.16453962988669860E+00, -0.16453962988669860E+00,  0.79585141789677305E+00 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o13 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O13 returns a 13 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[13], the weights.

    Output, double XYZ[3*13], the abscissas.
*/
{
  int order = 13;

  double w_save[13] = {
   0.063061594202898550725,
   0.063061594202898550725,
   0.063061594202898550725,
   0.063061594202898550725,
   0.042101946815575556199,
   0.042101946815575556199,
   0.042101946815575556199,
   0.042101946815575556199,
   0.13172030707666776585,
   0.13172030707666776585,
   0.13172030707666776585,
   0.13172030707666776585,
   0.05246460761943250889 };

  double xyz_save[3*13] = {
  -0.38510399211870384331,  -0.38510399211870384331,  0.428571428571428571429,
   0.38510399211870384331,  -0.38510399211870384331,  0.428571428571428571429,
   0.38510399211870384331,   0.38510399211870384331,  0.428571428571428571429,
  -0.38510399211870384331,   0.38510399211870384331,  0.428571428571428571429,
  -0.40345831960728204766,   0.00000000000000000000,  0.33928571428571428571,
   0.40345831960728204766,   0.00000000000000000000,  0.33928571428571428571,
   0.00000000000000000000,  -0.40345831960728204766,  0.33928571428571428571,
   0.00000000000000000000,   0.40345831960728204766,  0.33928571428571428571,
  -0.53157877436961973359,  -0.53157877436961973359,  0.08496732026143790850,
   0.53157877436961973359,  -0.53157877436961973359,  0.08496732026143790850,
   0.53157877436961973359,   0.53157877436961973359,  0.08496732026143790850,
  -0.53157877436961973359,   0.53157877436961973359,  0.08496732026143790850,
   0.00000000000000000000,   0.00000000000000000000,  0.76219701803768503595 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o09 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O09 returns a 9 point quadrature rule for the unit pyramid.
/
  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[9], the weights.

    Output, double XYZ[3*9], the abscissas.
*/
{
  int order = 9;

  double w_save[9] = {
   0.13073389672275944791,
   0.13073389672275944791,
   0.13073389672275944791,
   0.13073389672275944791,
   0.10989110327724055209,
   0.10989110327724055209,
   0.10989110327724055209,
   0.10989110327724055209,
   0.03750000000000000000 };

  double xyz_save[3*9] = {
  -0.52966422253852215131,  -0.52966422253852215131,   0.08176876558246862335,
   0.52966422253852215131,  -0.52966422253852215131,   0.08176876558246862335,
   0.52966422253852215131,   0.52966422253852215131,   0.08176876558246862335,
  -0.52966422253852215131,   0.52966422253852215131,   0.08176876558246862335,
  -0.34819753825720418039,  -0.34819753825720418039,   0.400374091560388519511,
   0.34819753825720418039,  -0.34819753825720418039,   0.400374091560388519511,
   0.34819753825720418039,   0.34819753825720418039,   0.400374091560388519511,
  -0.34819753825720418039,   0.34819753825720418039,   0.400374091560388519511,
   0.00000000000000000000,   0.00000000000000000000,   0.83333333333333333333 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o08b ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O08B returns an 8 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[8], the weights.

    Output, double XYZ[3*8], the abscissas.
*/
{
  int order = 8;

  double w_save[8] = {
   0.16438287736328777572,
   0.16438287736328777572,
   0.16438287736328777572,
   0.16438287736328777572,
   0.085617122636712224276,
   0.085617122636712224276,
   0.085617122636712224276,
   0.085617122636712224276 };

  double xyz_save[3*8] = {
  -0.51197009372656270107,  -0.51197009372656270107,   0.11024490204163285720,
   0.51197009372656270107,  -0.51197009372656270107,   0.11024490204163285720,
   0.51197009372656270107,   0.51197009372656270107,   0.11024490204163285720,
  -0.51197009372656270107,   0.51197009372656270107,   0.11024490204163285720,
  -0.28415447557052037456,  -0.28415447557052037456,   0.518326526529795714229,
   0.28415447557052037456,  -0.28415447557052037456,   0.518326526529795714229,
   0.28415447557052037456,   0.28415447557052037456,   0.518326526529795714229,
  -0.28415447557052037456,   0.28415447557052037456,   0.518326526529795714229 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o08 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O08 returns an 8 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[8], the weights.

    Output, double XYZ[3*8], the abscissas.
*/
{
  int order = 8;

 double w_save[8] = {
   0.075589411559869072938,
   0.075589411559869072938,
   0.075589411559869072938,
   0.075589411559869072938,
   0.17441058844013092706,
   0.17441058844013092706,
   0.17441058844013092706,
   0.17441058844013092706 };

  double xyz_save[3*8] = {
  -0.26318405556971359557,  -0.26318405556971359557,   0.54415184401122528880,
   0.26318405556971359557,  -0.26318405556971359557,   0.54415184401122528880,
   0.26318405556971359557,   0.26318405556971359557,   0.54415184401122528880,
  -0.26318405556971359557,   0.26318405556971359557,   0.54415184401122528880,
  -0.50661630334978742377,  -0.50661630334978742377,   0.12251482265544137787,
   0.50661630334978742377,  -0.50661630334978742377,   0.12251482265544137787,
   0.50661630334978742377,   0.50661630334978742377,   0.12251482265544137787,
  -0.50661630334978742377,   0.50661630334978742377,   0.12251482265544137787 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o06 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O06 returns a 6 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[6], the weights.

    Output, double XYZ[3*6], the abscissas.
*/
{
  int order = 6;

  double w_save[6] = {
   0.21000000000000000000,
   0.21000000000000000000,
   0.21000000000000000000,
   0.21000000000000000000,
   0.06000000000000000000,
   0.10000000000000000000 };

  double xyz_save[3*6] = {
  -0.48795003647426658968,  -0.48795003647426658968,   0.16666666666666666667,
   0.48795003647426658968,  -0.48795003647426658968,   0.16666666666666666667,
   0.48795003647426658968,   0.48795003647426658968,   0.16666666666666666667,
  -0.48795003647426658968,   0.48795003647426658968,   0.16666666666666666667,
   0.00000000000000000000,   0.00000000000000000000,   0.58333333333333333333,
   0.00000000000000000000,   0.00000000000000000000,   0.75000000000000000000 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void pyramid_unit_o18 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O18 returns an 18 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[18], the weights.

    Output, double XYZ[3*18], the abscissas.
*/
{
  int order = 18;

  double w_save[18] = {
   0.023330065296255886709,
   0.037328104474009418735,
   0.023330065296255886709,
   0.037328104474009418735,
   0.059724967158415069975,
   0.037328104474009418735,
   0.023330065296255886709,
   0.037328104474009418735,
   0.023330065296255886709,
   0.05383042853090460712,
   0.08612868564944737139,
   0.05383042853090460712,
   0.08612868564944737139,
   0.13780589703911579422,
   0.08612868564944737139,
   0.05383042853090460712,
   0.08612868564944737139,
   0.05383042853090460712 };

  double xyz_save[3*18] = {
  -0.35309846330877704481,  -0.35309846330877704481,  0.544151844011225288800,
   0.00000000000000000000,  -0.35309846330877704481,  0.544151844011225288800,
   0.35309846330877704481,  -0.35309846330877704481,  0.544151844011225288800,
  -0.35309846330877704481,   0.00000000000000000000,  0.544151844011225288800,
   0.00000000000000000000,   0.00000000000000000000,  0.544151844011225288800,
   0.35309846330877704481,   0.00000000000000000000,  0.544151844011225288800,
  -0.35309846330877704481,   0.35309846330877704481,  0.544151844011225288800,
   0.00000000000000000000,   0.35309846330877704481,  0.544151844011225288800,
   0.35309846330877704481,   0.35309846330877704481,  0.544151844011225288800,
  -0.67969709567986745790,  -0.67969709567986745790,  0.12251482265544137787,
   0.00000000000000000000,  -0.67969709567986745790,  0.12251482265544137787,
   0.67969709567986745790,  -0.67969709567986745790,  0.12251482265544137787,
  -0.67969709567986745790,   0.00000000000000000000,  0.12251482265544137787,
   0.00000000000000000000,   0.00000000000000000000,  0.12251482265544137787,
   0.67969709567986745790,   0.00000000000000000000,  0.12251482265544137787,
  -0.67969709567986745790,   0.67969709567986745790,  0.12251482265544137787,
   0.00000000000000000000,   0.67969709567986745790,  0.12251482265544137787,
   0.67969709567986745790,   0.67969709567986745790,  0.12251482265544137787 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
void line_o05 ( double w[], double x[] )

/******************************************************************************/
/*
  Purpose:

    LINE_O05 returns a 5 point quadrature rule for the unit line.

  Discussion:

    The integration region is:

    - 1.0 <= X <= 1.0

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 April 2009

  Author:

    John Burkardt

  Reference:

    Arthur Stroud,
    Approximate Calculation of Multiple Integrals,
    Prentice Hall, 1971,
    ISBN: 0130438936,
    LC: QA311.S85.

  Parameters:

    Output, double W[5], the weights.

    Output, double X[5], the abscissas.
*/
{
  int i;
  int order = 5;
  double w_save[5] = {
    0.118463442528095, 
    0.239314335249683, 
    0.284444444444444, 
    0.239314335249683, 
    0.118463442528095 };
  double x_save[5] = {
    -0.90617984593866399280,
    -0.53846931010568309104,
     0.00000000000000000000,
     0.53846931010568309104,
     0.90617984593866399280 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( order, x_save, x );

  return;
}
void pyramid_unit_o27 ( double w[], double xyz[] )

/******************************************************************************/
/*
  Purpose:

    PYRAMID_UNIT_O27 returns a 27 point quadrature rule for the unit pyramid.

  Discussion:

    The integration region is:

     - ( 1 - Z ) <= X <= 1 - Z
     - ( 1 - Z ) <= Y <= 1 - Z
               0 <= Z <= 1.

    When Z is zero, the integration region is a square lying in the (X,Y)
    plane, centered at (0,0,0) with "radius" 1.  As Z increases to 1, the
    radius of the square diminishes, and when Z reaches 1, the square has
    contracted to the single point (0,0,1).

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    02 April 2009

  Author:

    John Burkardt

  Reference:

    Carlos Felippa,
    A compendium of FEM integration formulas for symbolic work,
    Engineering Computation,
    Volume 21, Number 8, 2004, pages 867-890.

  Parameters:

    Output, double W[27], the weights.

    Output, double XYZ[3*27], the abscissas.
*/
{
  int order = 27;

  double w_save[27] = {
   0.036374157653908938268,
   0.05819865224625430123,
   0.036374157653908938268,
   0.05819865224625430123,
   0.09311784359400688197,
   0.05819865224625430123,
   0.036374157653908938268,
   0.05819865224625430123,
   0.036374157653908938268,
   0.033853303069413431019,
   0.054165284911061489631,
   0.033853303069413431019,
   0.054165284911061489631,
   0.08666445585769838341,
   0.054165284911061489631,
   0.033853303069413431019,
   0.054165284911061489631,
   0.033853303069413431019,
   0.006933033103838124540,
   0.011092852966140999264,
   0.006933033103838124540,
   0.011092852966140999264,
   0.017748564745825598822,
   0.011092852966140999264,
   0.006933033103838124540,
   0.011092852966140999264,
   0.006933033103838124540 };

  double xyz_save[3*27] = {
  -0.7180557413198889387,   -0.7180557413198889387,   0.07299402407314973216,
   0.00000000000000000000,  -0.7180557413198889387,   0.07299402407314973216,
   0.7180557413198889387,   -0.7180557413198889387,   0.07299402407314973216,
  -0.7180557413198889387,    0.00000000000000000000,  0.07299402407314973216,
   0.00000000000000000000,   0.00000000000000000000,  0.07299402407314973216,
   0.7180557413198889387,    0.00000000000000000000,  0.07299402407314973216,
  -0.7180557413198889387,    0.7180557413198889387,   0.07299402407314973216,
   0.00000000000000000000,   0.7180557413198889387,   0.07299402407314973216,
   0.7180557413198889387,    0.7180557413198889387,   0.07299402407314973216,
  -0.50580870785392503961,  -0.50580870785392503961,  0.34700376603835188472,
   0.00000000000000000000,  -0.50580870785392503961,  0.34700376603835188472,
   0.50580870785392503961,  -0.50580870785392503961,  0.34700376603835188472,
  -0.50580870785392503961,   0.00000000000000000000,  0.34700376603835188472,
   0.00000000000000000000,   0.00000000000000000000,  0.34700376603835188472,
   0.50580870785392503961,   0.00000000000000000000,  0.34700376603835188472,
  -0.50580870785392503961,   0.50580870785392503961,  0.34700376603835188472,
   0.00000000000000000000,   0.50580870785392503961,  0.34700376603835188472,
   0.50580870785392503961,   0.50580870785392503961,  0.34700376603835188472,
  -0.22850430565396735360,  -0.22850430565396735360,  0.70500220988849838312,
   0.00000000000000000000,  -0.22850430565396735360,  0.70500220988849838312,
   0.22850430565396735360,  -0.22850430565396735360,  0.70500220988849838312,
  -0.22850430565396735360,   0.00000000000000000000,  0.70500220988849838312,
   0.00000000000000000000,   0.00000000000000000000,  0.70500220988849838312,
   0.22850430565396735360,   0.00000000000000000000,  0.70500220988849838312,
  -0.22850430565396735360,   0.22850430565396735360,  0.70500220988849838312,
   0.00000000000000000000,   0.22850430565396735360,  0.70500220988849838312,
   0.22850430565396735360,   0.22850430565396735360,  0.70500220988849838312 };

  r8vec_copy ( order, w_save, w );
  r8vec_copy ( 3 * order, xyz_save, xyz );

  return;
}
示例#18
0
void line_cvt_lloyd ( int n, double a, double b, int it_num, char *header, 
  double x[] )

/******************************************************************************/
/*
  Purpose:

    LINE_CVT_LLOYD carries out the Lloyd algorithm.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    28 July 2014

  Author:

    John Burkardt

  Parameters:

    Input, int N, the number of generators.

    Input, double A, B, the left and right endpoints.

    Input, int IT_NUM, the number of iterations to take.

    Input, char *HEADER, an identifying string.

    Input/output, double X[N], the point locations.
*/
{
  double e;
  double *e_plot;
  int i;
  int it;
  double *x_old;
  double *x_plot;
  double xm;
  double *xm_plot;

  e_plot = ( double * ) malloc ( ( it_num + 1 ) * sizeof ( double ) );

  e = line_cvt_energy ( n, a, b, x );
  e_plot[0] = e;

  x_plot = ( double * ) malloc ( ( it_num + 1 ) * n * sizeof ( double ) );
  for ( i = 0; i < n; i++ )
  {
    x_plot[i+0*n] = x[i];
  }

  xm_plot = ( double * ) malloc ( it_num * sizeof ( double ) );

  x_old = ( double * ) malloc ( n * sizeof ( double ) );
  
  for ( it = 1; it <= it_num; it++ )
  {
    r8vec_copy ( n, x, x_old );

    line_cvt_lloyd_step ( n, a, b, x );

    for ( i = 0; i < n; i++ )
    {
      x_plot[i+it*n] = x[i];
    }

    e = line_cvt_energy ( n, a, b, x );
    e_plot[it] = e;

    xm = 0.0;
    for ( i = 0; i < n; i++ )
    {
      xm = xm + pow ( x_old[i] - x[i], 2 );
    }
    xm = xm / ( double ) ( n );
    xm_plot[it-1] = xm;
  }

  energy_plot ( it_num, e_plot, header );
  motion_plot ( it_num, xm_plot, header );
  evolution_plot ( n, it_num, x_plot, header );

  free ( e_plot );
  free ( x_old );
  free ( x_plot );
  free ( xm_plot );

  return;
}
示例#19
0
double *r8vec_house_column ( int n, double a[], int k )

/******************************************************************************/
/*
  Purpose:

    R8VEC_HOUSE_COLUMN defines a Householder premultiplier that "packs" a column.

  Discussion:

    An R8VEC is a vector of R8's.

    The routine returns a vector V that defines a Householder
    premultiplier matrix H(V) that zeros out the subdiagonal entries of
    column K of the matrix A.

       H(V) = I - 2 * v * v'

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    21 August 2010

  Author:

    John Burkardt

  Parameters:

    Input, int N, the order of the matrix A.

    Input, double A[N], column K of the matrix A.

    Input, int K, the column of the matrix to be modified.

    Output, double R8VEC_HOUSE_COLUMN[N], a vector of unit L2 norm which
    defines an orthogonal Householder premultiplier matrix H with the property
    that the K-th column of H*A is zero below the diagonal.
*/
{
  int i;
  double s;
  double *v;

  v = r8vec_zero_new ( n );

  if ( k < 1 || n <= k )
  {
    return v;
  }

  s = r8vec_norm_l2 ( n+1-k, a+k-1 );

  if ( s == 0.0 )
  {
    return v;
  }

  v[k-1] = a[k-1] + r8_abs ( s ) * r8_sign ( a[k-1] );

  r8vec_copy ( n-k, a+k, v+k );

  s = r8vec_norm_l2 ( n-k+1, v+k-1 );

  for ( i = k-1; i < n; i++ )
  {
    v[i] = v[i] / s;
  }

  return v;
}