|
k-dot-p 0.1
|
00001 /* 00002 * matdb: generic materials database information. 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 MATDB_H_ 00022 #define MATDB_H_ 00023 00024 #include <glib.h> 00025 00026 namespace kdotp { 00027 namespace libmodelxx { 00028 namespace structure { 00029 00030 struct matdb_material { 00031 GString *name; 00032 GHashTable *properties; 00033 }; 00034 00035 struct matdb_bowing { 00036 GString *from; 00037 GString *to; 00038 GHashTable *properties; 00039 }; 00040 00041 struct matdb { 00042 GHashTable *materials; 00043 GHashTable *bowings; 00044 }; 00045 00046 void print_matdb(const struct matdb *mdb); 00047 void destroy_material_gpointer(gpointer data); 00048 void destroy_bowing_gpointer(gpointer data); 00049 void destroy_material(struct matdb_material *mat); 00050 void destroy_bowing(struct matdb_bowing *bow); 00051 /*Inserts a material which is solely used to mark a region, e.g. when optimizing 00052 * the material properties by steepest descent 00053 *When queried, this material only returns NaNs. 00054 **/ 00055 void insert_external_material(struct matdb* matdb, const char* matname); 00056 double get_property1(const struct matdb* matdb, const char* ppt, const char* mat, int* err); 00057 double get_property2(const struct matdb* matdb, const char* ppt, const char* mat, const char* mat2, double x, int* err); 00058 double get_bowing(const struct matdb* matdb, const char* ppt, const char* mat1, const char* mat2, int* err) ; 00059 00060 GHashTable* get_material(const struct matdb* matdb, const char* mat1, const char* mat2, double x); 00061 00062 } 00063 } 00064 } 00065 00066 #endif