|
k-dot-p 0.1
|
00001 /* 00002 00003 00004 Copyright (C) 2009 Joseph Pingenot 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Affero General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Affero General Public License for more details. 00015 00016 You should have received a copy of the GNU Affero General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #ifndef GENERIC_STRUCTURE_HXX__ 00022 #define GENERIC_STRUCTURE_HXX__ 00023 00024 #include <glib.h> 00025 #include <libmodelxx/material.h++> 00026 #include <libmodelxx/grid.h++> 00027 #include <libmodelxx/fast_complex.h++> 00028 00029 namespace kdotp { 00030 namespace libmodelxx { 00031 namespace structure { 00032 00033 /*This is access to a generic structure, without vtables.*/ 00034 struct generic_structure { 00035 struct grid::grid* g; 00036 /*This is where the actual pointer to the classes are stored.*/ 00037 /*Type material**/ 00038 void* material_grid; 00039 /*Type double: the density (inverse-centimeters per length^dimension)*/ 00040 void* doping_grid; 00041 /*Type double: the electrostatic potential*/ 00042 void* potential_grid; 00043 /*6-component grid to hold the strain field*/ 00044 void* strain_grid; 00045 }; 00046 00047 struct generic_structure* generic_structure_new(struct grid::grid *g); 00048 00049 /** 00050 *Destroys a generic structure. 00051 *\param *s pointer to the structure to be freed. 00052 */ 00053 GError* generic_structure_free(struct generic_structure* s); 00054 void generic_structure_free_potential(struct generic_structure* s); 00055 00056 /* 00057 *Save the structure. 00058 *\param s the structure to save 00059 *\param file a string containing the filename 00060 *\return pointer to a GError giving the error. 00061 */ 00062 GError* generic_structure_save(struct generic_structure *s, const char* filename); 00063 /* 00064 *restore the structure. 00065 *\param s pointer to a pointer to a generic_structure (generic structure is allocated and restored here) 00066 *\param file a string containing the filename 00067 *\return pointer to a GError giving the error. 00068 */ 00069 GError* generic_structure_restore(struct generic_structure **s, const char* filename); 00070 00071 /* 00072 *dump the structure to an ASCII file. 00073 *\param s pointer to a pointer to a generic_structure (generic structure is allocated and restored here) 00074 *\param file a string containing the filename 00075 *\return pointer to a GError giving the error. 00076 */ 00077 GError* generic_structure_dump(struct generic_structure *s, GFile* file); 00078 00079 00080 00081 00082 00083 00084 00085 } 00086 } 00087 } 00088 00089 #endif