testHeatDtN.cpp 1.97 KB
Newer Older
Jan Zapletal's avatar
Jan Zapletal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#include "heatdtn.h"

#include <iostream>

const int nNodes = 8;
const int nElems = 12;

double nodes [ 3 * nNodes ] = {
   1.0, -1.0, -1.0,
   1.0,  1.0, -1.0,
  -1.0,  1.0, -1.0,
  -1.0, -1.0, -1.0,
   1.0, -1.0,  1.0,
   1.0,  1.0,  1.0,
  -1.0,  1.0,  1.0,
  -1.0, -1.0,  1.0
};

int elems [ 3 * nElems ] = {
  0, 1, 5,
  0, 5, 4,
  1, 2, 6,
  1, 6, 5,
  2, 7, 6,
  2, 3, 7,
  3, 0, 4,
  3, 4, 7,
  0, 3, 1,
  2, 1, 3,
  4, 5, 6,
  4, 6, 7
};

34 35 36 37 38 39 40 41 42 43 44
double dirichlet [ nNodes ] = {
   1.0,
   1.0,
   1.0,
   1.0,
   1.0,
   1.0,
   1.0,
   1.0
};

45 46
double point [ 3 ] = { 0.1, 0.2, 0.3 };

Jan Zapletal's avatar
Jan Zapletal committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
void testHeatDtN(
  );

int main(
  int argc,
  char** argv
  ) {

  testHeatDtN( );

  return 0;
}

void testHeatDtN(
  ) {

63 64 65
  double * S = new double [ nNodes * nNodes ];
  double * a = new double [ nNodes ];
  double beta;
Jan Zapletal's avatar
Jan Zapletal committed
66 67 68 69 70 71 72 73 74 75
  double alpha = 1.0;
  int qType = 1;
  int orderNear = 4;
  int orderFar = 4;

  bem4i::bem4idata<int, double> * data;

  bool nonsymmetric = false;
  bool verbose = true;

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
  bem4i::getLaplaceSteklovPoincare(
    S,
    a,
    &beta,
    nNodes,
    nodes,
    nElems,
    elems,
    alpha,
    qType,
    orderNear,
    orderFar,
    data,
    nonsymmetric,
    verbose );
Jan Zapletal's avatar
Jan Zapletal committed
91

92
  if( verbose ){
93

94
    std::cout << "S: " << std::endl;
Jan Zapletal's avatar
Jan Zapletal committed
95 96
    for( size_t i = 0; i < nNodes; ++i ){
      for( size_t j = 0; j < nNodes; ++j ){
97
        std::cout << S[ j * nNodes + i ] << " ";
Jan Zapletal's avatar
Jan Zapletal committed
98
      }
99 100
      std::cout << std::endl;
    }
101

102 103 104
    std::cout << "a: " << std::endl;
    for( size_t i = 0; i < nNodes; ++i ){
        std::cout << a[ i ] << " ";
105
    }
Jan Zapletal's avatar
Jan Zapletal committed
106
    std::cout << std::endl;
107

108
    std::cout << "beta: " << std::endl << beta << std::endl;
Jan Zapletal's avatar
Jan Zapletal committed
109
  }
110

111 112
  delete [] S;
  delete [] a;
Jan Zapletal's avatar
Jan Zapletal committed
113

114
  double value = 0.0;
115 116

  bem4i::evaluateLaplaceRepresentationFormula(
117
    &value,
118 119 120 121 122 123
    nNodes,
    nodes,
    nElems,
    elems,
    1,
    point,
124
    alpha,
125 126 127 128
    dirichlet,
    orderFar,
    data,
    verbose );
Jan Zapletal's avatar
Jan Zapletal committed
129

130
    if( verbose )
131
      std::cout << "value: " << std::endl << value << std::endl;
132 133 134 135

    bem4i::deleteBem4iData<int, double>( data );

}