diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp index 89fb2b680aceb935736514334200c242a2587612..0741d6f2ea3ecd3afcf73f673798c45a2bead67d 100644 --- a/Common/Gmsh.cpp +++ b/Common/Gmsh.cpp @@ -102,7 +102,7 @@ int GmshBatch() if(!CTX::instance()->bgmFileName.empty()) { MergeFile(CTX::instance()->bgmFileName); if(PView::list.size()) - GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1); + GModel::current()->getFields()->setBackgroundMesh(PView::list.size() - 1); else Msg::Error("Invalid background mesh (no view)"); } diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index a696b8cfd0ed739f100e273ef34fc365387d0228..9d51557af4a5715d3c6142bf654bdb50be661063 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -114,11 +114,11 @@ void SetBoundingBox() CTX::instance()->cg[i] = 0.5 * (CTX::instance()->min[i] + CTX::instance()->max[i]); } -// FIXME: this is necessary for now to have an approximate CTX::instance()->lc -// *while* parsing input files (it's important since some of the -// geometrical operations use a tolerance that depends on -// CTX::instance()->lc). This will be removed once the new database is filled -// directly during the parsing step +// FIXME: this is necessary for now to have an approximate +// CTX::instance()->lc *while* parsing input files (it's important +// since some of the geometrical operations use a tolerance that +// depends on CTX::instance()->lc). This will be removed once the new +// database is filled directly during the parsing step static SBoundingBox3d temp_bb; void ResetTemporaryBoundingBox() diff --git a/Common/Options.cpp b/Common/Options.cpp index 1ef246898600419597bade74663e9ce7b3cb29df..6ffae185a78b72d332e4d4d8a4696458e6107c08 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -811,7 +811,7 @@ void Print_OptionsDoc() it != fields.map_type_name.end(); it++){ fprintf(file, "@item %s\n", it->first.c_str()); Field *f = (*it->second)(); - std::string field_description=f->get_description(); + std::string field_description=f->getDescription(); Sanitize_String_Texi(field_description); fprintf(file,"%s@*\n",field_description.c_str()); fprintf(file, "Options:@*\n"); @@ -820,11 +820,11 @@ void Print_OptionsDoc() it2 != f->options.end(); it2++){ fprintf(file, "@item %s\n", it2->first.c_str()); std::string val; - it2->second->get_text_representation(val); + it2->second->getTextRepresentation(val); Sanitize_String_Texi(val); fprintf(file, "%s@*\ntype: %s@*\ndefault value: @code{%s}\n", - it2->second->get_description().c_str(), - it2->second->get_type_name().c_str(),val.c_str()); + it2->second->getDescription().c_str(), + it2->second->getTypeName().c_str(), val.c_str()); } fprintf(file, "@end table\n\n"); } diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index 138a271b6ce89371821f792b709c39fd8320e83c..57c4ab40bab2f7f2182f13645bdab2842ca4a854 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) if(!CTX::instance()->bgmFileName.empty()) { MergeFile(CTX::instance()->bgmFileName); if(PView::list.size()) - GModel::current()->getFields()->set_background_mesh(PView::list.size() - 1); + GModel::current()->getFields()->setBackgroundMesh(PView::list.size() - 1); else Msg::Error("Invalid background mesh (no view)"); } diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index cfbf705c8b9ab2a7a7148aa176ec0f743c4522e5..bfda4058c6c6a61e14867dabcff46289d0911730 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -44,7 +44,7 @@ static void field_new_cb(Fl_Widget *w, void *data) { Fl_Menu_Button* mb = ((Fl_Menu_Button*)w); FieldManager *fields = GModel::current()->getFields(); - int id = fields->new_id(); + int id = fields->newId(); add_field(id, mb->text(), GModel::current()->getFileName()); GUI::instance()->fields->editField((*fields)[id]); } @@ -69,9 +69,9 @@ static void field_put_on_view_cb(Fl_Widget *w, void *data) Fl_Menu_Button* mb = ((Fl_Menu_Button*)w); Field *field = (Field*)GUI::instance()->fields->editor_group->user_data(); if(mb->value() == 0) - field->put_on_new_view(); + field->putOnNewView(); else if(mb->value() - 1 < PView::list.size()) - field->put_on_view(PView::list[mb->value() - 1]); + field->putOnView(PView::list[mb->value() - 1]); GUI::instance()->updateViews(); Draw(); } @@ -208,7 +208,7 @@ void fieldWindow::loadFieldList() std::ostringstream sstream; if(it->first == fields.background_field) sstream << "@b"; - sstream << it->first << " " << field->get_name(); + sstream << it->first << " " << field->getName(); browser->add(sstream.str().c_str(), field); if(it->second == selected_field) browser->select(i_entry); @@ -227,7 +227,7 @@ void fieldWindow::saveFieldOptions() it != f->options.end(); it++){ FieldOption *option = it->second; sstream.str(""); - switch(option->get_type()){ + switch(option->getType()){ case FIELD_OPTION_STRING: case FIELD_OPTION_PATH: sstream << "\"" << ((Fl_Input*)*input)->value() << "\""; @@ -286,17 +286,17 @@ void fieldWindow::loadFieldOptions() FieldOption *option = it->second; std::ostringstream vstr; std::list<int>::iterator list_it; - switch(option->get_type()){ + switch(option->getType()){ case FIELD_OPTION_STRING: case FIELD_OPTION_PATH: ((Fl_Input*)(*input))->value(option->string().c_str()); break; case FIELD_OPTION_INT: case FIELD_OPTION_DOUBLE: - ((Fl_Value_Input*)(*input))->value(option->numerical_value()); + ((Fl_Value_Input*)(*input))->value(option->numericalValue()); break; case FIELD_OPTION_BOOL: - ((Fl_Check_Button*)(*input))->value((int)option->numerical_value()); + ((Fl_Check_Button*)(*input))->value((int)option->numericalValue()); break; case FIELD_OPTION_LIST: vstr.str(""); @@ -334,7 +334,7 @@ void fieldWindow::editField(Field *f) empty_message->hide(); editor_group->show(); editor_group->user_data(f); - title->label(f->get_name()); + title->label(f->getName()); options_scroll->clear(); options_widget.clear(); options_scroll->begin(); @@ -342,7 +342,7 @@ void fieldWindow::editField(Field *f) int yy = options_scroll->y(); help_display->clear(); help_display->add("\n"); - add_multiline_in_browser(help_display, "", f->get_description().c_str(), 100); + add_multiline_in_browser(help_display, "", f->getDescription().c_str(), 100); help_display->add("\n"); help_display->add("@b@cOptions"); for(std::map<std::string, FieldOption*>::iterator it = f->options.begin(); @@ -350,10 +350,10 @@ void fieldWindow::editField(Field *f) Fl_Widget *input; help_display->add("\n"); help_display->add(("@b" + it->first).c_str()); - help_display->add(("@i" + it->second->get_type_name()).c_str()); + help_display->add(("@i" + it->second->getTypeName()).c_str()); add_multiline_in_browser - (help_display, "", it->second->get_description().c_str(), 100); - switch(it->second->get_type()){ + (help_display, "", it->second->getDescription().c_str(), 100); + switch(it->second->getType()){ case FIELD_OPTION_INT: case FIELD_OPTION_DOUBLE: input = new Fl_Value_Input(xx, yy, IW, BH, it->first.c_str()); diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index 71546f26b2a0a18b7de3f8d929ea9841ae1dcb8f..ad61d789c0b68f3a22be8e055ff0761cc229c184 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -2130,7 +2130,7 @@ static void view_applybgmesh_cb(Fl_Widget *w, void *data) { int index = (int)(long)data; if(index >= 0 && index < (int)PView::list.size()){ - GModel::current()->getFields()->set_background_mesh(index); + GModel::current()->getFields()->setBackgroundMesh(index); } } diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index 85b2f65f458c0d02c3896df15d1fb97fd9a8b286..d5b034f7a1ef37eb3faf670bbba5572e32cc7323 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -176,7 +176,7 @@ class writeFieldOptionGEO { void operator() (std::pair<std::string, FieldOption *> it) { std::string v; - it.second->get_text_representation(v); + it.second->getTextRepresentation(v); fprintf(geo, "Field[%i].%s = %s;\n", field->id, it.first.c_str(), v.c_str()); } }; @@ -188,7 +188,7 @@ class writeFieldGEO { writeFieldGEO(FILE *fp) { geo = fp ? fp : stdout; } void operator() (std::pair<const int, Field *> it) { - fprintf(geo, "Field[%i] = %s;\n", it.first, it.second->get_name()); + fprintf(geo, "Field[%i] = %s;\n", it.first, it.second->getName()); std::for_each(it.second->options.begin(), it.second->options.end(), writeFieldOptionGEO(geo, it.second)); } diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index c5ed333f75c6fe76bc4872668551fd0f612a306d..89b4e9a0591d3d64858995d8926d5ed603936b79 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -696,7 +696,7 @@ int NEWVOLUME(void) int NEWFIELD(void) { - return (GModel::current()->getFields()->max_id() + 1); + return (GModel::current()->getFields()->maxId() + 1); } int NEWPHYSICAL(void) diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index 07de92cce0a517bc4c671298353b0e0ce7bcf3b3..ffcbf5f828e61da1dcfa01d02a4e467c6953924c 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -39,12 +39,12 @@ class FieldOptionDouble : public FieldOption { public: double &val; - FieldOptionType get_type(){ return FIELD_OPTION_DOUBLE; } + FieldOptionType getType(){ return FIELD_OPTION_DOUBLE; } FieldOptionDouble(double &_val, std::string _help, bool *_status=0) : FieldOption(_help, _status), val(_val){} - double numerical_value() const { return val; } - void numerical_value(double v){ modified(); val = v; } - void get_text_representation(std::string &v_str) + double numericalValue() const { return val; } + void numericalValue(double v){ modified(); val = v; } + void getTextRepresentation(std::string &v_str) { std::ostringstream sstream; sstream.precision(16); @@ -57,12 +57,12 @@ class FieldOptionInt : public FieldOption { public: int &val; - FieldOptionType get_type(){ return FIELD_OPTION_INT; } + FieldOptionType getType(){ return FIELD_OPTION_INT; } FieldOptionInt(int &_val, std::string _help, bool *_status=0) : FieldOption(_help, _status), val(_val){} - double numerical_value() const { return val; } - void numerical_value(double v){ modified(); val = (int)v; } - void get_text_representation(std::string & v_str) + double numericalValue() const { return val; } + void numericalValue(double v){ modified(); val = (int)v; } + void getTextRepresentation(std::string & v_str) { std::ostringstream sstream; sstream << val; @@ -74,12 +74,12 @@ class FieldOptionList : public FieldOption { public: std::list<int> &val; - FieldOptionType get_type(){ return FIELD_OPTION_LIST; } + FieldOptionType getType(){ return FIELD_OPTION_LIST; } FieldOptionList(std::list<int> &_val, std::string _help, bool *_status=0) : FieldOption(_help, _status), val(_val) {} std::list<int> &list(){ modified(); return val; } const std::list<int>& list() const { return val; } - void get_text_representation(std::string & v_str) + void getTextRepresentation(std::string & v_str) { std::ostringstream sstream; sstream << "{"; @@ -97,12 +97,12 @@ class FieldOptionString : public FieldOption { public: std::string & val; - virtual FieldOptionType get_type(){ return FIELD_OPTION_STRING; } + virtual FieldOptionType getType(){ return FIELD_OPTION_STRING; } FieldOptionString(std::string &_val, std::string _help, bool *_status=0) : FieldOption(_help, _status), val(_val) {} std::string &string() { modified(); return val; } const std::string &string() const { return val; } - void get_text_representation(std::string &v_str) + void getTextRepresentation(std::string &v_str) { std::ostringstream sstream; sstream << "\"" << val << "\""; @@ -113,7 +113,7 @@ class FieldOptionString : public FieldOption class FieldOptionPath : public FieldOptionString { public: - virtual FieldOptionType get_type(){ return FIELD_OPTION_PATH; } + virtual FieldOptionType getType(){ return FIELD_OPTION_PATH; } FieldOptionPath(std::string &_val, std::string _help, bool *_status=0) : FieldOptionString(_val, _help, _status) {} }; @@ -122,12 +122,12 @@ class FieldOptionBool : public FieldOption { public: bool & val; - FieldOptionType get_type(){ return FIELD_OPTION_BOOL; } + FieldOptionType getType(){ return FIELD_OPTION_BOOL; } FieldOptionBool(bool & _val, std::string _help, bool *_status=0) : FieldOption(_help, _status), val(_val) {} - double numerical_value() const { return val; } - void numerical_value(double v){ modified(); val = v; } - void get_text_representation(std::string & v_str) + double numericalValue() const { return val; } + void numericalValue(double v){ modified(); val = v; } + void getTextRepresentation(std::string & v_str) { std::ostringstream sstream; sstream << val; @@ -150,7 +150,7 @@ Field *FieldManager::get(int id) return it->second; } -Field *FieldManager::new_field(int id, std::string type_name) +Field *FieldManager::newField(int id, std::string type_name) { if(find(id) != end()) { Msg::Error("Field id %i is already defined.", id); @@ -168,7 +168,7 @@ Field *FieldManager::new_field(int id, std::string type_name) return f; } -int FieldManager::new_id() +int FieldManager::newId() { int i = 0; iterator it = begin(); @@ -182,7 +182,7 @@ int FieldManager::new_id() return std::max(i, 1); } -int FieldManager::max_id() +int FieldManager::maxId() { if(!empty()) return rbegin()->first; @@ -190,7 +190,7 @@ int FieldManager::max_id() return 0; } -void FieldManager::delete_field(int id) +void FieldManager::deleteField(int id) { iterator it = find(id); if(it == end()) { @@ -222,7 +222,7 @@ class StructuredField : public Field &update_needed); data = 0; } - std::string get_description() + std::string getDescription() { return "Linearly interpolate between data provided on a 3D rectangular\n" "structured grid.\n\n" @@ -239,7 +239,7 @@ class StructuredField : public Field "between nodes in each direction, n are the numbers of nodes in each\n" "direction, and v are the values on each node."; } - const char *get_name() + const char *getName() { return "Structured"; } @@ -323,7 +323,7 @@ class UTMField : public Field double a, b, n, n2, n3, n4, n5, e, e2, e1, e12, e13, e14, J1, J2, J3, J4, Ap, Bp, Cp, Dp, Ep, e4, e6, ep, ep2, ep4, k0, mu_fact; public: - std::string get_description() + std::string getDescription() { return "Evaluate Field[IField] in Universal Transverse Mercator coordinates.\n" "The formulas for the coordinates transformation are taken from:\n\n" @@ -369,7 +369,7 @@ class UTMField : public Field k0 = 0.9996; mu_fact = 1 / (k0 * a * (1 - e2 / 4 - 3 * e4 / 64 - 5 * e6 / 256)); } - const char *get_name() + const char *getName() { return "UTM"; } @@ -409,7 +409,7 @@ class LonLatField : public Field { int field_id; public: - std::string get_description() + std::string getDescription() { return "Evaluate Field[IField] in geographic coordinates (longitude, latitude):\n\n" " F = Field[IField](atan(y/x), asin(z/sqrt(x^2+y^2+z^2))"; @@ -420,7 +420,7 @@ class LonLatField : public Field options["IField"] = new FieldOptionInt (field_id, "Index of the field to evaluate."); } - const char *get_name() + const char *getName() { return "LonLat"; } @@ -436,7 +436,7 @@ class BoxField : public Field { double v_in, v_out, x_min, x_max, y_min, y_max, z_min, z_max; public: - std::string get_description() + std::string getDescription() { return "The value of this field is VIn inside the box, VOut outside the box.\n" "The box is given by\n\n" @@ -464,7 +464,7 @@ class BoxField : public Field options["ZMax"] = new FieldOptionDouble (z_max, "Maximum Z coordinate of the box"); } - const char *get_name() + const char *getName() { return "Box"; } @@ -481,11 +481,11 @@ class ThresholdField : public Field double dmin, dmax, lcmin, lcmax; bool sigmoid, stopAtDistMax; public: - const char *get_name() + const char *getName() { return "Threshold"; } - std::string get_description() + std::string getDescription() { return "F = LCMin if Field[IField] <= DistMin,\n" "F = LCMax if Field[IField] >= DistMax,\n" @@ -543,11 +543,11 @@ class GradientField : public Field int iField, kind; double delta; public: - const char *get_name() + const char *getName() { return "Gradient"; } - std::string get_description() + std::string getDescription() { return "Compute the finite difference gradient of Field[IField]:\n\n" " F = (Field[IField](X + Delta/2) -\n" @@ -605,11 +605,11 @@ class CurvatureField : public Field int iField; double delta; public: - const char *get_name() + const char *getName() { return "Curvature"; } - std::string get_description() + std::string getDescription() { return "Compute the curvature of Field[IField]:\n\n" " F = div(norm(grad(Field[IField])))"; @@ -654,11 +654,11 @@ class MaxEigenHessianField : public Field int iField; double delta; public: - const char *get_name() + const char *getName() { return "MaxEigenHessian"; } - std::string get_description() + std::string getDescription() { return "Compute the maximum eigenvalue of the Hessian matrix of\n" "Field[IField], with the gradients evaluated by finite differences:\n\n" @@ -704,11 +704,11 @@ class LaplacianField : public Field int iField; double delta; public: - const char *get_name() + const char *getName() { return "Laplacian"; } - std::string get_description() + std::string getDescription() { return "Compute finite difference the Laplacian of Field[IField]:\n\n" " F = G(x+d,y,z) + G(x-d,y,z) +\n" @@ -741,11 +741,11 @@ class MeanField : public Field int iField; double delta; public: - const char *get_name() + const char *getName() { return "Mean"; } - std::string get_description() + std::string getDescription() { return "Simple smoother:\n\n" " F = (G(x+delta,y,z) + G(x-delta,y,z) +\n" @@ -885,11 +885,11 @@ class MathEvalField : public Field } return expr.evaluate(x, y, z); } - const char *get_name() + const char *getName() { return "MathEval"; } - std::string get_description() + std::string getDescription() { return "Evaluate a mathematical expression. The expression can contain\n" "x, y, z for spatial coordinates, F0, F1, ... for field values, and\n" @@ -915,7 +915,7 @@ class ParametricField : public Field options["FZ"] = new FieldOptionString (f[2], "Z component of parametric function", &update_needed); } - std::string get_description() + std::string getDescription() { return "Evaluate Field IField in parametric coordinates:\n\n" " F = Field[IField](FX,FY,FZ)\n\n" @@ -938,7 +938,7 @@ class ParametricField : public Field expr[1].evaluate(x, y, z), expr[2].evaluate(x, y, z)); } - const char *get_name() + const char *getName() { return "Param"; } @@ -968,11 +968,11 @@ class PostViewField : public Field if(l <= 0 && crop_negative_values) return MAX_LC; return l; } - const char *get_name() + const char *getName() { return "PostView"; } - std::string get_description() + std::string getDescription() { return "Evaluate the post processing view IView."; } @@ -1004,7 +1004,7 @@ class MinField : public Field options["FieldsList"] = new FieldOptionList (idlist, "Field indices", &update_needed); } - std::string get_description() + std::string getDescription() { return "Take the minimum value of a list of fields."; } @@ -1017,7 +1017,7 @@ class MinField : public Field } return v; } - const char *get_name() + const char *getName() { return "Min"; } @@ -1032,7 +1032,7 @@ class MaxField : public Field options["FieldsList"] = new FieldOptionList (idlist, "Field indices", &update_needed); } - std::string get_description() + std::string getDescription() { return "Take the maximum value of a list of fields."; } @@ -1045,7 +1045,7 @@ class MaxField : public Field } return v; } - const char *get_name() + const char *getName() { return "Max"; } @@ -1064,7 +1064,7 @@ class RestrictField : public Field options["FacesList"] = new FieldOptionList(faces, "Surface indices"); options["RegionsList"] = new FieldOptionList(regions, "Volume indices"); } - std::string get_description() + std::string getDescription() { return "Restrict the application of a field to a given list of geometrical\n" "curves, surfaces or volumes."; @@ -1084,7 +1084,7 @@ class RestrictField : public Field return (*f) (x, y, z); return MAX_LC; } - const char *get_name() + const char *getName() { return "Restrict"; } @@ -1123,11 +1123,11 @@ class AttractorField : public Field delete[]index; delete[]dist; } - const char *get_name() + const char *getName() { return "Attractor"; } - std::string get_description() + std::string getDescription() { return "Compute the distance from the nearest node in a list. It can also\n" "be used to compute the distance from curves, in which case each curve\n" @@ -1281,7 +1281,7 @@ Field::Field() } #if !defined(HAVE_NO_POST) -void Field::put_on_new_view() +void Field::putOnNewView() { if(GModel::current()->getMeshStatus() < 1){ Msg::Error("No mesh available to create the view: please mesh your model!"); @@ -1302,7 +1302,7 @@ void Field::put_on_new_view() view->setChanged(true); } -void Field::put_on_view(PView *view, int comp) +void Field::putOnView(PView *view, int comp) { PViewData *data = view->getData(); for(int ent = 0; ent < data->getNumEntities(0); ent++){ @@ -1326,11 +1326,11 @@ void Field::put_on_view(PView *view, int comp) } #endif -void FieldManager::set_background_mesh(int iView) +void FieldManager::setBackgroundMesh(int iView) { - int id = new_id(); - Field *f = new_field(id, "PostView"); - f->options["IView"]->numerical_value(iView); + int id = newId(); + Field *f = newField(id, "PostView"); + f->options["IView"]->numericalValue(iView); (*this)[id] = f; background_field = id; } diff --git a/Mesh/Field.h b/Mesh/Field.h index f0e3bfb82782f6c8b9c10b0d26f8dd52c80c3a73..a35e770137398d38f36b265a1dcc4af53797a64f 100644 --- a/Mesh/Field.h +++ b/Mesh/Field.h @@ -36,11 +36,11 @@ class FieldOption { public: FieldOption(std::string help, bool *_status) : _help(help), status(_status) {} virtual ~FieldOption() {} - virtual FieldOptionType get_type() = 0; - virtual void get_text_representation(std::string & v_str) = 0; - virtual std::string get_description(){ return _help; } - std::string get_type_name(){ - switch(get_type()){ + virtual FieldOptionType getType() = 0; + virtual void getTextRepresentation(std::string & v_str) = 0; + virtual std::string getDescription(){ return _help; } + std::string getTypeName(){ + switch(getType()){ case FIELD_OPTION_INT: return "integer"; break; case FIELD_OPTION_DOUBLE: return "float"; break; case FIELD_OPTION_BOOL: return "boolean"; break; @@ -50,8 +50,8 @@ class FieldOption { default: return "unknown"; } } - virtual void numerical_value(double val) { throw(1); } - virtual double numerical_value() const { throw(1); } + virtual void numericalValue(double val) { throw(1); } + virtual double numericalValue() const { throw(1); } virtual const std::list<int> &list() const { throw(1); } virtual std::list<int> &list() { throw(1); } virtual const std::string &string() const { throw(1); } @@ -66,12 +66,12 @@ class Field { virtual ~Field() {} bool update_needed; Field(); - virtual const char *get_name() = 0; + virtual const char *getName() = 0; #if !defined(HAVE_NO_POST) - void put_on_view(PView * view, int comp = -1); - void put_on_new_view(); + void putOnView(PView * view, int comp = -1); + void putOnNewView(); #endif - virtual std::string get_description(){ return ""; } + virtual std::string getDescription(){ return ""; } }; class FieldFactory { @@ -85,14 +85,14 @@ class FieldManager : public std::map<int, Field*> { std::map<std::string, FieldFactory*> map_type_name; void reset(); Field *get(int id); - Field *new_field(int id, std::string type_name); - void delete_field(int id); - int new_id(); - int max_id(); + Field *newField(int id, std::string type_name); + void deleteField(int id); + int newId(); + int maxId(); FieldManager(); int background_field; // compatibility with -bgm - void set_background_mesh(int iView); + void setBackgroundMesh(int iView); }; #endif diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 5c288153308926c1ddddd0b4070aaf0b5f3a6832..7099ca209f78f02048768bd70213db3ce8e73823 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -4529,7 +4529,7 @@ yyreduce: case 80: #line 885 "Gmsh.y" { - if(!GModel::current()->getFields()->new_field((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c))) + if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c))) yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} @@ -4542,15 +4542,15 @@ yyreduce: if(field){ FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; if(option){ - try { option->numerical_value((yyvsp[(8) - (9)].d)); } + try { option->numericalValue((yyvsp[(8) - (9)].d)); } catch(...){ yymsg(0, "Cannot assign a numerical value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name()); + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name()); + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); @@ -4568,12 +4568,12 @@ yyreduce: try { option->string() = (yyvsp[(8) - (9)].c); } catch (...){ yymsg(0, "Cannot assign a string value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name()); + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->get_name()); + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); @@ -4599,7 +4599,7 @@ yyreduce: } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->get_name()); + (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName()); } else yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); @@ -5488,7 +5488,7 @@ yyreduce: case 134: #line 1726 "Gmsh.y" { - GModel::current()->getFields()->delete_field((int)(yyvsp[(4) - (6)].d)); + GModel::current()->getFields()->deleteField((int)(yyvsp[(4) - (6)].d)); ;} break; @@ -5688,7 +5688,7 @@ yyreduce: if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh") && !strcmp((yyvsp[(3) - (7)].c), "View")){ int index = (int)(yyvsp[(5) - (7)].d); if(index >= 0 && index < (int)PView::list.size()) - GModel::current()->getFields()->set_background_mesh(index); + GModel::current()->getFields()->setBackgroundMesh(index); else yymsg(0, "Unknown view %d", index); } diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 5dd0bf6e2ef9dba4441482e2b9e39b9e9f63b0a0..8764084d9c517b1f0ded91093c5373ea4385820d 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -883,7 +883,7 @@ Affectation : } | tField '[' FExpr ']' tAFFECT tSTRING tEND { - if(!GModel::current()->getFields()->new_field((int)$3, $6)) + if(!GModel::current()->getFields()->newField((int)$3, $6)) yymsg(0, "Cannot create field %i of type '%s'", (int)$3, $6); Free($6); } @@ -893,15 +893,15 @@ Affectation : if(field){ FieldOption *option = field->options[$6]; if(option){ - try { option->numerical_value($8); } + try { option->numericalValue($8); } catch(...){ yymsg(0, "Cannot assign a numerical value to option '%s' " - "in field %i of type '%s'", $6, (int)$3, field->get_name()); + "in field %i of type '%s'", $6, (int)$3, field->getName()); } } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - $6, (int)$3, field->get_name()); + $6, (int)$3, field->getName()); } else yymsg(0, "No field with id %i", (int)$3); @@ -916,12 +916,12 @@ Affectation : try { option->string() = $8; } catch (...){ yymsg(0, "Cannot assign a string value to option '%s' " - "in field %i of type '%s'", $6, (int)$3, field->get_name()); + "in field %i of type '%s'", $6, (int)$3, field->getName()); } } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - $6, (int)$3, field->get_name()); + $6, (int)$3, field->getName()); } else yymsg(0, "No field with id %i", (int)$3); @@ -944,7 +944,7 @@ Affectation : } else yymsg(0, "Unknown option '%s' in field %i of type '%s'", - $6, (int)$3, field->get_name()); + $6, (int)$3, field->getName()); } else yymsg(0, "No field with id %i", (int)$3); @@ -1724,7 +1724,7 @@ Delete : } | tDelete tField '[' FExpr ']' tEND { - GModel::current()->getFields()->delete_field((int)$4); + GModel::current()->getFields()->deleteField((int)$4); } | tDelete tSTRING '[' FExpr ']' tEND { @@ -1906,7 +1906,7 @@ Command : if(!strcmp($1, "Background") && !strcmp($2, "Mesh") && !strcmp($3, "View")){ int index = (int)$5; if(index >= 0 && index < (int)PView::list.size()) - GModel::current()->getFields()->set_background_mesh(index); + GModel::current()->getFields()->setBackgroundMesh(index); else yymsg(0, "Unknown view %d", index); } diff --git a/Plugin/FieldView.cpp b/Plugin/FieldView.cpp index 9e69f97760ccd8e0b4955af86df1966ee99bfb9c..80b2fdea461ca329c43f68267fdd640f7879e2e0 100644 --- a/Plugin/FieldView.cpp +++ b/Plugin/FieldView.cpp @@ -62,6 +62,6 @@ PView *GMSH_FieldViewPlugin::execute(PView *v) } PView *v1 = getView(iView, v); if(!v1) return v; - field->put_on_view(v1); + field->putOnView(v1); return v1; }