gimme-alpha 0.1

nanostructures.c File Reference

#include <unistd.h>
#include <stdlib.h>
#include <libmodeling/nanostructures.h>
#include <libcommon/gcc_hints.h>
Include dependency graph for nanostructures.c:

Go to the source code of this file.

Functions

static void region_1d_free (struct region_1d *region)
static void doping_region_1d_free (struct doping_region_1d *region)
static void foreach_region_1d_free (gpointer region, gpointer private)
static void foreach_doping_region_1d_free (gpointer region, gpointer private)
void nanostructure_1d_free (struct nanostructure_1d *s)
void nanostructure_free (struct nanostructure *s)
struct doping_region_1ddoping_region_1d_new (enum doping_type dt)
struct region_1dregion_1d_new ()
struct nanostructure_1dnanostructure_1d_new ()
struct nanostructurenanostructure_new (enum nanostructure_type type)

Function Documentation

static void doping_region_1d_free ( struct doping_region_1d region) [static]

Definition at line 40 of file nanostructures.c.

Referenced by foreach_doping_region_1d_free().

                                                                   {
  free(region);
}

Here is the caller graph for this function:

struct doping_region_1d* doping_region_1d_new ( enum doping_type  dt) [read]

Definition at line 76 of file nanostructures.c.

References unlikely.

                                                                   {
  struct doping_region_1d *dr;
  if(unlikely((dr = malloc(sizeof(struct doping_region_1d))) == NULL)) return NULL;
  return dr;
}
static void foreach_doping_region_1d_free ( gpointer  region,
gpointer  private 
) [static]

Definition at line 49 of file nanostructures.c.

References doping_region_1d_free().

Referenced by nanostructure_1d_free().

                                                                             {
  doping_region_1d_free(region);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void foreach_region_1d_free ( gpointer  region,
gpointer  private 
) [static]

Definition at line 45 of file nanostructures.c.

References region_1d_free().

Referenced by nanostructure_1d_free().

                                                                      {
  region_1d_free(region);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nanostructure_1d_free ( struct nanostructure_1d s)

Definition at line 53 of file nanostructures.c.

References nanostructure_1d::doping_regions, foreach_doping_region_1d_free(), foreach_region_1d_free(), and nanostructure_1d::regions.

Referenced by nanostructure_free().

                                                       {
  g_list_foreach(s->regions, foreach_region_1d_free, NULL);
  g_list_foreach(s->doping_regions, foreach_doping_region_1d_free, NULL);
  free(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct nanostructure_1d* nanostructure_1d_new ( ) [read]

Definition at line 88 of file nanostructures.c.

References nanostructure_1d::doping_regions, nanostructure_1d::regions, and unlikely.

Referenced by nanostructure_new().

                                                {
  struct nanostructure_1d *s;
  if(unlikely((s = malloc(sizeof(struct nanostructure_1d))) == NULL)) return NULL;
  s->regions = s->doping_regions = NULL;
  return s;
}

Here is the caller graph for this function:

void nanostructure_free ( struct nanostructure s)

Definition at line 59 of file nanostructures.c.

References likely, nanostructure_1d_free(), NS_D1, nanostructure::storage, and nanostructure::type.

Referenced by nanostructure_new().

                                                 {
  if(likely((s->storage) != NULL)) {
    switch(s->type) {
    case NS_D1:
      nanostructure_1d_free(s->storage);
      break;
    default:
      nanostructure_free(s);
    }
  }
  free(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct nanostructure* nanostructure_new ( enum nanostructure_type  type) [read]

Definition at line 95 of file nanostructures.c.

References nanostructure_1d_new(), nanostructure_free(), NS_D1, nanostructure::storage, nanostructure::type, and unlikely.

Referenced by get_nanostructure().

                                                                      {
  struct nanostructure *s;
  if(unlikely((s = malloc(sizeof(struct nanostructure))) == NULL)) return NULL;
  switch(type) {
  case NS_D1:
    s->type = type;
    s->storage = nanostructure_1d_new();
    break;
  default:
    s->storage = NULL;
  }
  /*Catch allocation errors and de-allocate if we errored*/
  if(unlikely((s->storage) == NULL)) {
    nanostructure_free(s);
  }
  return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void region_1d_free ( struct region_1d region) [static]

Definition at line 36 of file nanostructures.c.

Referenced by foreach_region_1d_free().

                                                     {
  free(region);
}

Here is the caller graph for this function:

struct region_1d* region_1d_new ( ) [read]

Definition at line 82 of file nanostructures.c.

References unlikely.

                                  {
  struct region_1d *r;
  if(unlikely((r = malloc(sizeof(struct region_1d))) == NULL)) return NULL;
  return r;
}
 All Classes Files Functions Variables Enumerations Enumerator Defines