gimme-alpha 0.1

nextnano_postprocessing.c File Reference

#include <stdlib.h>
#include <glib.h>
#include <libnextnano/nextnano_postprocessing.h>
#include <libnextnano/read_nextnano_inputfile.h>
#include <libcommon/gcc_hints.h>
Include dependency graph for nextnano_postprocessing.c:

Go to the source code of this file.

Functions

void nextnano_region_d1_free (struct nextnano_region_d1 *r)
void nextnano_region_free (struct nextnano_region *r)
struct nextnano_region_d1nextnano_region_d1_new ()
struct nextnano_regionnextnano_region_new (enum nextnano_region_type type)
struct nanostructureget_nanostructure (GHashTable *ifile, int *err)

Function Documentation

struct nanostructure* get_nanostructure ( GHashTable *  ifile,
int *  err 
) [read]

Definition at line 79 of file nextnano_postprocessing.c.

References INT_TYPE, nanostructure_new(), nextnano_region_new(), NNR_D1, NS_D1, read_nextnano_extract_item_typed(), and unlikely.

                                                                     {
  int lerr;
  char *val;
  double *d;
  int *i;
  GList *regions = NULL;
  *err = 0;
  struct nanostructure *s;
  if(unlikely((s=nanostructure_new(NS_D1)) == NULL)) {
    *err = 2;
    return NULL;
  }
  struct nextnano_region *r;
  /*First, figure out what regions we have*/
  i = read_nextnano_extract_item_typed(ifile, "simulation-dimension", 1, "dimension", &lerr, INT_TYPE);
  if((*i) != 1) {
    *err = 1;
  }
  for(int c=0; (i = read_nextnano_extract_item_typed(ifile, "regions", 1, "region-number", &lerr, INT_TYPE)) != NULL; c++) {
    if(unlikely((r=nextnano_region_new(NNR_D1)) == NULL)) {
      *err = 3;
      /*Continue; we're going to be missing a region; let the caller
  decide what to do*/
      continue;
    }
    
  }
  /*Any unclaimed sections of the overall nanostructure size are in
    the default material.*/
  return s;
}

Here is the call graph for this function:

void nextnano_region_d1_free ( struct nextnano_region_d1 r)

Definition at line 33 of file nextnano_postprocessing.c.

References nextnano_region_d1::material.

Referenced by nextnano_region_free().

                                                           {
  if(r->material != NULL) {
    g_string_free(r->material, TRUE);
  }
  free(r);
}

Here is the caller graph for this function:

struct nextnano_region_d1* nextnano_region_d1_new ( ) [read]

Definition at line 51 of file nextnano_postprocessing.c.

References nextnano_region_d1::material, and unlikely.

Referenced by nextnano_region_new().

                                                    {
  struct nextnano_region_d1 *r;
  if(unlikely((r = (struct nextnano_region_d1*)malloc(sizeof(struct nextnano_region_d1))) == NULL)) return NULL;
  r->material = NULL;
  return r;
}

Here is the caller graph for this function:

void nextnano_region_free ( struct nextnano_region r)

Definition at line 40 of file nextnano_postprocessing.c.

References nextnano_region_d1_free(), NNR_D1, nextnano_region::storage, and nextnano_region::type.

                                                     {
  if(r->storage != NULL) {
    switch(r->type){
    case NNR_D1:
      nextnano_region_d1_free(r->storage);
      break;
    }
  }
  free(r);
}

Here is the call graph for this function:

struct nextnano_region* nextnano_region_new ( enum nextnano_region_type  type) [read]

Definition at line 58 of file nextnano_postprocessing.c.

References nextnano_region_d1_new(), NNR_D1, nextnano_region::storage, nextnano_region::type, and unlikely.

Referenced by get_nanostructure().

                                                                            {
  struct nextnano_region *r;
  if(unlikely((r = (struct nextnano_region*)malloc(sizeof(struct nextnano_region))) == NULL)) return NULL;
  r->type = type;
  switch(type){
  case NNR_D1:
    r->storage = nextnano_region_d1_new();
    break;
  }
  if(unlikely((r->storage) == NULL)) {
    free(r);
  }
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Files Functions Variables Enumerations Enumerator Defines