Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_DILATION_H
00002 #define OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_DILATION_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace grid
00015 {
00024 template<
00025 typename grid_type_in
00026 , typename real_type
00027 , typename grid_type_out
00028 >
00029 inline void dilation(
00030 grid_type_in const & phi
00031 , real_type const & radius
00032 , real_type const & dt
00033 , grid_type_out & psi
00034 )
00035 {
00036 typedef typename grid_type_in::value_type input_type;
00037 typedef typename grid_type_out::value_type output_type;
00038 typedef typename grid_type_in::const_index_iterator input_iterator;
00039
00040 assert(radius>0 || !"dilation(): radius must be positive");
00041 assert(dt>0 || !"dilation(): time-step must be positive");
00042
00043 input_iterator input_begin = phi.begin();
00044 input_iterator input_end = phi.end();
00045 input_iterator input;
00046 input_type unused = phi.unused();
00047 for(input=input_begin;input!=input_end;++input)
00048 if(*input!=unused)
00049 psi(input.get_index()) = *input - dt*radius;
00050 }
00051
00052 }
00053
00054 }
00055
00056
00057 #endif