MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Stencil.cpp File Reference
#include <vector>
#include <cassert>
#include "Stencil.h"
+ Include dependency graph for Stencil.cpp:

Go to the source code of this file.

Functions

void stencil1 (vector< double > &f, int index, unsigned int n, double invSq, const vector< vector< double > > &S, const vector< double > &diffConst)
 
void stencilN (vector< double > &f, int index, unsigned int n, int offset, double invSq, const vector< vector< double > > &S, const vector< double > &diffConst)
 

Function Documentation

void stencil1 ( vector< double > &  f,
int  index,
unsigned int  n,
double  invSq,
const vector< vector< double > > &  S,
const vector< double > &  diffConst 
)

Definition at line 18 of file Stencil.cpp.

Referenced by LineStencil::addFlux(), RectangleStencil::addFlux(), and CuboidStencil::addFlux().

22 {
23  const vector< double >& t0 = S[ index ];
24  if ( index - static_cast< int >( n ) < 0 ) {
25  const vector< double >& temp = S[ index + n ];
26  for ( unsigned int i = 0; i < f.size(); ++i ) {
27  f[i] += 2 * diffConst[i] * ( temp[i] - t0[i] ) * invSq;
28  }
29  } else if ( index + n >= S.size() ) {
30  const vector< double >& temp = S[ index - n ];
31  for ( unsigned int i = 0; i < f.size(); ++i ) {
32  f[i] += 2 * diffConst[i] * ( temp[i] - t0[i] ) * invSq;
33  }
34  } else {
35  const vector< double >& tminus = S[ index - n ];
36  const vector< double >& tplus = S[ index + n ];
37  for ( unsigned int i = 0; i < f.size(); ++i ) {
38  f[i] += diffConst[i] * ( tminus[i] + tplus[i] - 2 * t0[i] ) * invSq;
39  }
40  }
41 }

+ Here is the caller graph for this function:

void stencilN ( vector< double > &  f,
int  index,
unsigned int  n,
int  offset,
double  invSq,
const vector< vector< double > > &  S,
const vector< double > &  diffConst 
)

f is the flux vector, returned to caller index is the meshIndex being computed n is the number of mesh entries in this stencil. It is nx for the x axis and nx*ny for the y axis. offset is the stencil displacement: 1 for the x axis, nx for the y axis, doesn't apply for the z axis as that will be done using stencil1. invSq is 1/dx for the x axis, 1/dy for the y axis, and so on. S is the matrix of [meshEntries][pools] diffConst is the vector of [pools]

Definition at line 55 of file Stencil.cpp.

Referenced by RectangleStencil::addFlux(), and CuboidStencil::addFlux().

58 {
59  const vector< double >& t0 = S[ index ];
60  int rem = index % n;
61  if ( rem < offset ) {
62  const vector< double >& temp = S[ index + offset];
63  for ( unsigned int i = 0; i < f.size(); ++i ) {
64  f[i] += 2 * diffConst[i] * ( temp[i] - t0[i] ) * invSq;
65  }
66  } else if ( rem >= static_cast< int >( n ) - offset ) {
67  const vector< double >& temp = S[ index - offset ];
68  for ( unsigned int i = 0; i < f.size(); ++i ) {
69  f[i] += 2 * diffConst[i] * ( temp[i] - t0[i] ) * invSq;
70  }
71  } else {
72  const vector< double >& tminus = S[ index - offset ];
73  const vector< double >& tplus = S[ index + offset ];
74  for ( unsigned int i = 0; i < f.size(); ++i ) {
75  f[i] += diffConst[i] * ( tminus[i] + tplus[i] - 2 * t0[i] ) * invSq;
76  }
77  }
78 }

+ Here is the caller graph for this function: