QPMS
Electromagnetic multiple scattering library and toolkit.
Data Fields
PGen Struct Reference

Generic lattice point generator type. More...

#include <lattices.h>

Collaboration diagram for PGen:
Collaboration graph
[legend]

Data Fields

const struct PGenClassInfoc
 Pointer to the "class" metadata defining the behaviour of the generator.
 
void * stateData
 Pointer to internal state data; shall be NULL if invalid (destroyed);.
 

Detailed Description

Generic lattice point generator type.

A bit of OOP-in-C brainfuck here.

The basic principle of operation is following: Instead of a list (array) of points, an initialized PGen object is passed to a function that does something over a set of points. Each time PGen-type object is "called" (more specifically, one of the "methods" specified in the PGenClassInfo structure in c, it returns PGenReturnData which contains a point in given coordinates (depending on the generator class) and some metadata.

After the last generated point, the generator frees all internal memory and returns PGenSphReturnData with PGEN_NOTDONE flag unset (the rest shall be considered invalid data). The caller can also decide not to use the rest and end getting the points even when the PGEN_NOTDONE was set in the last returned data. In such case, the caller shall call PGen_destroy() manually.

Methods

The standard wrapper "methods" to generate a single point in a given coordinate system are

Memory management policy

The basic PGen structure shall be allocated on stack (it's only two pointers), everything internal goes on heap.


The documentation for this struct was generated from the following file: