plugin_src/operator/fast_conv.c File Reference

#include <complex.h>
#include <fftw3.h>
#include "crusde_api.h"
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
Include dependency graph for fast_conv.c:

Defines

#define RESET(x, y)   (x = y = -1)
#define POSITION(m, n)   (n+(N_Y)*m)

Functions

void register_output_fields ()
void register_parameter ()
 Register parameters this Kernel claims from the input.
void request_plugins ()
void init ()
 Initialization of the convolution. Allocation of memory for inputs and outputs.
void clear ()
void run ()
 Performs the fast convolution.
const char * get_name ()
const char * get_version ()
const char * get_authors ()
const char * get_description ()
PluginCategory get_category ()

Variables

double * load_in
double * green_in
double * conv_out
double * green_back
fftw_complex * load_out
fftw_complex * green_out
fftw_complex * conv_in
fftw_plan load_plan
fftw_plan green_plan
fftw_plan conv_plan
double ** model_buffer
double ** result
int N
int N_X
int N_Y
int size_x
int size_y
int x = -1
int y = -1
int i = 0
int n = -1
unsigned long int t = 0
int dimensions = 1
int displacement_dimensions = 1
boolean is_initialized = false

Detailed Description

Implements a fast convolution using the Fast Fourier Transform (DFT). This Plugin depends on the FFTW3 library, http://www.fftw3.org , which is used to allow convolution in the spectral domain (see convolution theorem).


Define Documentation

#define POSITION ( m,
n   )     (n+(N_Y)*m)
#define RESET ( x,
y   )     (x = y = -1)

Referenced by run().


Function Documentation

void clear (  ) 

Frees memory allocated during init(). FFTW plans are destroyed.

References conv_in, conv_out, conv_plan, dimensions, green_back, green_in, green_out, green_plan, is_initialized, load_in, load_out, load_plan, model_buffer, n, and result.

const char* get_authors (  ) 
PluginCategory get_category (  ) 

References KERNEL_PLUGIN.

const char* get_description (  ) 
const char* get_name (  ) 
const char* get_version (  ) 
void init (  ) 

Initialization of the convolution. Allocation of memory for inputs and outputs.

The field sizes are adjusted according to the needs to avoid wrap around effects in the spectal domain and allow for effective use of DFT (lenght and width are a power of 2). Memory is allocated using fftw_malloc for DFT inputs and outputs (load_in, load_out, green_in, green_out, conv_in, conv_out). Three FFTW plans are created for DFT transform of Green and load arrays and IDFT of the convolution result back to original domain.

References conv_in, conv_out, conv_plan, crusde_get_dimensions(), crusde_get_displacement_dimensions(), crusde_get_size_x(), crusde_get_size_y(), crusde_set_operator_space(), dimensions, displacement_dimensions, green_back, green_in, green_out, green_plan, i, is_initialized, load_in, load_out, load_plan, model_buffer, n, N, N_X, N_Y, result, size_x, size_y, and x.

void register_output_fields (  ) 

empty

void register_parameter (  ) 

Register parameters this Kernel claims from the input.

This plugin calls register_kernel_param() defined in crusde_api.h to register references to parameters this Kernel will need to operate properly. For command line use the order of registration in this function defines the identification of parameters in the command line string (i.e. './green -KfirstRegistered/secondRegistered/...'). In case an XML is used to configure the experiment, the reference to this parameter will be identified by the string passed as second argument to register_kernel_param().

This function registers the references in the following order:

Thus, the command line parameter string is: -K

See also:
register_kernel_param()
register_parameter() (temp_plugin.c.tmp)
void request_plugins (  ) 

empty

void run (  ) 

Performs the fast convolution.

Requests values for each point in the examined area from Green's function (only once when modeltime == 0) and load function (every timestep). Does the origin shifting necessary for the Green's function values. The Green's function values are requested for each displacement direction the Green's function registered with the CrusDe.

FFTW plan is executed for the load. Then for each Green's function displacement direction the FFTW plan is executed, a complex multiplication of the DFT results performed and then for product the FFTW plan is executed (IDFT). The result of the convolution is extracted from the oversized IDFT result and cropped to the original size of the examined region.

CAN ONLY BE USE FOR ONE LOAD (i.e. multiple loads in one load file), to realize reuse of this operator in fast_conv_time_space - the loads want to have independent load histories!

References conv_in, conv_out, conv_plan, crusde_get_green_at(), crusde_get_load_at(), crusde_info(), crusde_model_time(), crusde_set_quadrant(), crusde_set_result(), displacement_dimensions, get_name(), green_back, green_in, green_out, green_plan, i, load_in, load_out, load_plan, model_buffer, N, n, N_X, N_Y, RESET, result, size_x, size_y, t, x, and y.


Variable Documentation

fftw_complex * conv_in

Referenced by clear(), init(), and run().

double * conv_out

Referenced by clear(), init(), and run().

fftw_plan conv_plan

Referenced by clear(), init(), and run().

int dimensions = 1

Referenced by clear(), init(), and run().

Referenced by init(), and run().

double * green_back

Referenced by clear(), init(), and run().

double * green_in

Referenced by clear(), init(), and run().

fftw_complex * green_out

Referenced by clear(), init(), and run().

fftw_plan green_plan

Referenced by clear(), init(), and run().

int i = 0
boolean is_initialized = false
double* load_in

Referenced by clear(), init(), and run().

fftw_complex* load_out

Referenced by clear(), init(), and run().

fftw_plan load_plan

Referenced by clear(), init(), and run().

double** model_buffer

Referenced by clear(), init(), and run().

int n = -1
int N

Referenced by init(), and run().

int N_X

Referenced by init(), and run().

int N_Y

Referenced by init(), and run().

double ** result
int size_x
int size_y
unsigned long int t = 0
int x = -1
int y = -1

Generated on Tue Feb 16 15:18:28 2010 for CrusDe by  doxygen 1.6.1-20091004