void RegisterLuaUserDataType(Registry& reg, string type, string grp) { string suffix = GetDimensionSuffix<dim>(); string tag = GetDimensionTag<dim>(); // LuaUser"Type" { typedef ug::LuaUserData<TData, dim> T; typedef CplUserData<TData, dim> TBase; string name = string("LuaUser").append(type).append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*)>("Callback") .template add_constructor<void (*)(LuaFunctionHandle)>("handle") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("LuaUser").append(type), tag); } // LuaCondUser"Type" { typedef ug::LuaUserData<TData, dim, bool> T; typedef CplUserData<TData, dim, bool> TBase; string name = string("LuaCondUser").append(type).append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*)>("Callback") .template add_constructor<void (*)(LuaFunctionHandle)>("handle") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("LuaCondUser").append(type), tag); } }
static void Domain(Registry& reg, string grp) { string suffix = GetDomainSuffix<TDomain>(); string tag = GetDomainTag<TDomain>(); #ifdef UG_PARALLEL { typedef DomainBalanceWeights<TDomain, AnisotropicBalanceWeights<TDomain::dim> > T; string name = string("AnisotropicBalanceWeights").append(suffix); reg.add_class_<T, IBalanceWeights>(name, grp) .template add_constructor<void (*)(TDomain&)>() .add_method("set_weight_factor", &T::set_weight_factor) .add_method("weight_factor", &T::weight_factor) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "AnisotropicBalanceWeights", tag); } { typedef BalanceWeightsLuaCallback<TDomain> T; string name = string("BalanceWeightsLuaCallback").append(suffix); reg.add_class_<T, IBalanceWeights>(name, grp) .template add_constructor<void (*)(SmartPtr<TDomain> spDom, const char* luaCallbackName)>() .add_method("set_time", &T::set_time) .add_method("time", &T::time) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "BalanceWeightsLuaCallback", tag); } { string name = string("DomainLoadBalancer").append(suffix); typedef DomainLoadBalancer<TDomain> T; typedef LoadBalancer TBase; reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(SmartPtr<TDomain>)>("Domain") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "DomainLoadBalancer", tag); } reg.add_function("CreateProcessHierarchy", static_cast<SPProcessHierarchy (*)(TDomain&, size_t, size_t, size_t, int, int)> (&CreateProcessHierarchy<TDomain>), grp, "ProcessHierarchy", "Domain, minNumElemsPerProcPerLvl, " "maxNumRedistProcs, maxNumProcs, minDistLvl, " "maxLvlsWithoutRedist"); reg.add_function("CreateProcessHierarchy", static_cast<SPProcessHierarchy (*)(TDomain&, size_t, size_t, size_t, int, int, IRefiner*)> (&CreateProcessHierarchy<TDomain>), grp, "ProcessHierarchy", "Domain, minNumElemsPerProcPerLvl, " "maxNumRedistProcs, maxNumProcs, minDistLvl, " "maxLvlsWithoutRedist, refiner"); #endif }
static void RegisterDynamicBisectionPartitioner( Registry& reg, string name, string grpName, string clsGrpName) { reg.add_class_<TPartitioner, IPartitioner>(name, grpName) .template add_constructor<void (*)(TDomain&)>() .add_method("set_subset_handler", &TPartitioner::set_subset_handler) .add_method("enable_longest_split_axis", &TPartitioner::enable_longest_split_axis) .add_method("enable_split_axis", &TPartitioner::enable_split_axis) .add_method("set_start_split_axis", &TPartitioner::set_start_split_axis) .add_method("num_split_improvement_iterations", &TPartitioner::num_split_improvement_iterations) .add_method("set_num_split_improvement_iterations", &TPartitioner::set_num_split_improvement_iterations) .add_method("enable_static_partitioning", &TPartitioner::enable_static_partitioning) .add_method("static_partitioning_enabled", &TPartitioner::static_partitioning_enabled) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, clsGrpName, GetDomainTag<TDomain>()); }
void RegisterGeometry(Registry& reg, string grp) { typedef IGeometry<dim> T; string suffix = GetDimensionSuffix<dim>(); string tag = GetDimensionTag<dim>(); string name = mkstr("IGeometry" << suffix); reg.add_class_<T>(name, grp); reg.add_class_to_group(name, "IGeometry", tag); }
static void RegisterSmoothPartitionBounds( Registry& reg, string name, string grpName, string clsGrpName) { typedef SmoothPartitionBounds<elem_t> T; reg.add_class_<T, IPartitionPostProcessor>(name, grpName) .add_constructor() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, clsGrpName, GetDomainTag<TDomain>()); }
static void RegisterClusterElementStacks( Registry& reg, string name, string grpName, string clsGrpName) { typedef Attachment<vector_t> apos_t; typedef ClusterElementStacks<elem_t, vector_t> T; reg.add_class_<T, IPartitionPostProcessor>(name, grpName) .add_constructor() .template add_constructor<void (*)(const apos_t&, const vector_t&)>() .add_method("set_position_attachment", &T::set_position_attachment) .add_method("set_stacking_direction", &T::set_stacking_direction) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, clsGrpName, GetDomainTag<TDomain>()); }
static void RegisterRaster(Registry& reg, string name, string grp) { string suffix = GetDimensionSuffix<TDIM>(); string tag = GetDimensionTag<TDIM>(); typedef Raster<TValue, TDIM> T; string fullName = name + suffix; reg.add_class_<T>(fullName, grp) .template add_constructor<void (*)()>() .add_method("dim", &T::dim, "dimension", "", "Returns the dimension of the raster.") .add_method( "load_from_asc", &T::load_from_asc, "", "filename", "Loads the given file and creates the raster accordingly.") .add_method( "save_to_asc", &T::save_to_asc, "", "filename", "Saves the given raster to an 'asc' file.") .add_method( "set_num_nodes", static_cast<void (T::*)(int, size_t)>(&T::set_num_nodes), "", "dim # numNodes", "set the number of nodes for the given dimension.") .add_method( "num_nodes", static_cast<size_t (T::*)(int) const>(&T::num_nodes), "numNodes", "dim", "returns the number of nodes for the given dimension.") .add_method( "create", &T::create, "", "", "Creates the raster according to the set number of nodes (use 'set_num_nodes').") .add_method( "set_min_corner", static_cast<void (T::*)(int, number)>(&T::set_min_corner), "", "dim # coordinate", "set the coordinate of the minimum corner of the raster for the given dimension.") .add_method( "min_corner", static_cast<number (T::*)(int) const>(&T::min_corner), "coordinate", "dim", "returns the coordinate of the minimum corner of the raster for the given dimension.") .add_method( "set_extension", static_cast<void (T::*)(int, number)>(&T::set_extension), "", "dim # coordinate", "set the extension of the raster for the given dimension.") .add_method( "extension", static_cast<number (T::*)(int) const>(&T::extension), "coordinate", "dim", "returns the extension of the raster for the given dimension.") .add_method( "select_node", static_cast<void (T::*)(int, size_t)>(&T::select_node), "", "dim # index", "select a node by specifying the index in each dimension.") .add_method( "selected_node_value", &T::selected_node_value, "value", "", "returns the value of the selected node (use 'select_node' to select a node).") .add_method( "set_selected_node_value", &T::set_selected_node_value, "", "value", "set the value of the selected node (use 'select_node' to select a node).") .add_method( "set_cursor", static_cast<void (T::*)(int, number)>(&T::set_cursor), "", "dim # coordinate", "set the coordinate of the cursor for each dimension.") .add_method( "interpolate_at_cursor", &T::interpolate_at_cursor, "value", "", "returns the interpolated value (using the given order) at the cursor (use 'set_cursor' to set the cursor).") .add_method( "set_no_data_value", &T::set_no_data_value, "", "value", "set the 'no-data-value'of the raster. Nodes with this value are ignored in some applications.") .add_method( "no_data_value", &T::no_data_value, "value", "", "returns the 'no-data-value'of the raster. Nodes with this value are ignored in some applications."); reg.add_class_to_group(fullName, name, tag); }
static void Dimension(Registry& reg, string grp) { string suffix = GetDimensionSuffix<dim>(); string tag = GetDimensionTag<dim>(); RegisterLuaUserDataType<number, dim>(reg, "Number", grp); RegisterLuaUserDataType<MathVector<dim>, dim>(reg, "Vector", grp); RegisterLuaUserDataType<MathMatrix<dim,dim>, dim>(reg, "Matrix", grp); // LuaUserFunctionNumber { typedef LuaUserFunction<number, dim, number> T; typedef DependentUserData<number, dim> TBase; string name = string("LuaUserFunctionNumber").append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*, int)>("LuaCallbackName#NumberOfArguments") .template add_constructor<void (*)(const char*, int, bool)>("LuaCallbackName#NumberOfArguments#PosTimeFlag") .add_method("set_deriv", &T::set_deriv) .add_method("set_input", static_cast<void (T::*)(size_t, SmartPtr<CplUserData<number, dim> >)>(&T::set_input)) .add_method("set_input", static_cast<void (T::*)(size_t, number)>(&T::set_input)) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "LuaUserFunctionNumber", tag); } // LuaUserFunctionMatrixNumber { typedef LuaUserFunction<MathMatrix<dim,dim>, dim, number> T; typedef DependentUserData<MathMatrix<dim,dim>, dim> TBase; string name = string("LuaUserFunctionMatrixNumber").append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*, int)>("LuaCallbackName#NumberOfArguments") .template add_constructor<void (*)(const char*, int, bool)>("LuaCallbackName#NumberOfArguments#PosTimeFlag") .add_method("set_deriv", &T::set_deriv) .add_method("set_input", static_cast<void (T::*)(size_t, SmartPtr<CplUserData<number, dim> >)>(&T::set_input)) .add_method("set_input", static_cast<void (T::*)(size_t, number)>(&T::set_input)) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "LuaUserFunctionMatrixNumber", tag); } // LuaUserFunctionVectorNumber { typedef LuaUserFunction<MathVector<dim>, dim, number > T; typedef DependentUserData<MathVector<dim>, dim> TBase; string name = string("LuaUserFunctionVectorNumber").append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*, int)>("LuaCallbackName#NumberOfArguments") .template add_constructor<void (*)(const char*, int, bool)>("LuaCallbackName#NumberOfArguments#PosTimeFlag") .add_method("set_deriv", &T::set_deriv) .add_method("set_input", static_cast<void (T::*)(size_t, SmartPtr<CplUserData<number, dim> >)>(&T::set_input)) .add_method("set_input", static_cast<void (T::*)(size_t, number)>(&T::set_input)) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "LuaUserFunctionVectorNumber", tag); } /* // LuaUserFunctionNumberVector { typedef LuaUserFunction<number, dim, MathVector<dim> > T; typedef DependentUserData<number, dim> TBase; string name = string("LuaUserFunctionNumberVector").append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*, int)>("LuaCallbackName, NumberOfArguments") .template add_constructor<void (*)(const char*, int, bool)>("LuaCallbackName, NumberOfArguments, PosTimeFlag") .add_method("set_deriv", &T::set_deriv) .add_method("set_input", static_cast<void (T::*)(size_t, SmartPtr<CplUserData<number, dim> >)>(&T::set_input)) .add_method("set_input", static_cast<void (T::*)(size_t, number)>(&T::set_input)) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "LuaUserFunctionNumberVector", tag); } */ }
void RegisterUserDataType(Registry& reg, string grp) { string dimSuffix = GetDimensionSuffix<dim>(); string dimTag = GetDimensionTag<dim>(); string type = user_data_traits<TData>::name(); // User"Type" // NOTE: For better readability this class is named User"Type" // in vrl and lua. E.g. UserNumber, UserVector, ... { typedef UserData<TData, dim> T; typedef UserDataInfo TBase1; string name = string("User").append(type).append(dimSuffix); reg.add_class_<T,TBase1>(name, grp) .add_method("get_dim", &T::get_dim) .add_method("type", &T::type); reg.add_class_to_group(name, string("User").append(type), dimTag); reg.add_function("PrintUserDataValue", &PrintUserDataValue<TData, dim>, grp, "", "userData#position#time#subsetIndex", "Prints the value of the given user data at the given global position at the given time on the given subset."); } // CondUser"Type" // NOTE: For better readability this class is named CondUser"Type" // in vrl and lua. E.g. CondUserNumber, CondUserVector, ... { typedef UserData<TData, dim, bool> T; typedef UserDataInfo TBase1; string name = string("CondUser").append(type).append(dimSuffix); reg.add_class_<T,TBase1>(name, grp); reg.add_class_to_group(name, string("CondUser").append(type), dimTag); reg.add_function("PrintUserDataValue", &PrintCondUserDataValue<TData, dim>, grp, "", "userData#position#time#subsetIndex", "Prints the value of the given user data at the given global position at the given time on the given subset."); } // CplUser"Type" { typedef CplUserData<TData, dim> T; typedef UserData<TData,dim> TBase1; string name = string("CplUser").append(type).append(dimSuffix); reg.add_class_<T,TBase1>(name, grp) .add_method("get_dim", &T::get_dim) .add_method("type", &T::type); reg.add_class_to_group(name, string("CplUser").append(type), dimTag); } // CondCplUser"Type" { typedef CplUserData<TData, dim, bool> T; typedef UserData<TData,dim,bool> TBase1; string name = string("CondCplUser").append(type).append(dimSuffix); reg.add_class_<T,TBase1>(name, grp); reg.add_class_to_group(name, string("CondCplUser").append(type), dimTag); } // DependentUserData"Type" { typedef DependentUserData<TData, dim> T; typedef CplUserData<TData, dim> TBase; string name = string("DependentUserData").append(type).append(dimSuffix); reg.add_class_<T, TBase >(name, grp); reg.add_class_to_group(name, string("DependentUserData").append(type), dimTag); } // ScaleAddLinker"Type" { typedef ScaleAddLinker<TData, dim, number> T; typedef DependentUserData<TData, dim> TBase; string name = string("ScaleAddLinker").append(type).append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> > , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(number , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> > , number)>(&T::add)) .add_method("add", static_cast<void (T::*)(number,number)>(&T::add)) .add_constructor() .template add_constructor<void (*)(const ScaleAddLinker<TData, dim, number>&)>() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("ScaleAddLinker").append(type), dimTag); } }
static void Dimension(Registry& reg, string grp) { string dimSuffix = GetDimensionSuffix<dim>(); string dimTag = GetDimensionTag<dim>(); RegisterUserDataType<number, dim>(reg, grp); RegisterUserDataType<MathVector<dim>, dim>(reg, grp); RegisterUserDataType<MathMatrix<dim,dim>, dim>(reg, grp); RegisterUserDataType<MathTensor<4,dim>, dim>(reg, grp); // ConstUserNumber { typedef ConstUserNumber<dim> T; typedef CplUserData<number, dim> TBase; string name = string("ConstUserNumber").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_constructor() .template add_constructor<void (*)(number)>("Value") .add_method("set", &T::set, "", "Value") .add_method("print", &T::print) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "ConstUserNumber", dimTag); } // ConstUserVector { typedef ConstUserVector<dim> T; typedef CplUserData<MathVector<dim>, dim> TBase; string name = string("ConstUserVector").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_constructor() .template add_constructor<void (*)(number)>("Values") .template add_constructor<void (*)(const std::vector<number>&)>("Values") .add_method("set_all_entries", &T::set_all_entries) .add_method("set_entry", &T::set_entry) .add_method("print", &T::print) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "ConstUserVector", dimTag); } // ConstUserMatrix { typedef ConstUserMatrix<dim> T; typedef CplUserData<MathMatrix<dim, dim>, dim> TBase; string name = string("ConstUserMatrix").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_constructor() .template add_constructor<void (*)(number)>("Diagonal Value") .add_method("set_diag_tensor", &T::set_diag_tensor) .add_method("set_all_entries", &T::set_all_entries) .add_method("set_entry", &T::set_entry) .add_method("print", &T::print) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "ConstUserMatrix", dimTag); } // ScaleAddLinkerMatrixVector { typedef MathVector<dim> TData; typedef MathMatrix<dim,dim> TDataScale; typedef ScaleAddLinker<TData, dim, TDataScale> T; typedef DependentUserData<TData, dim> TBase; string name = string("ScaleAddLinkerVectorMatrix").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<TDataScale,dim> > , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(number , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<TDataScale,dim> > , number)>(&T::add)) .add_method("add", static_cast<void (T::*)(number,number)>(&T::add)) .add_constructor() .template add_constructor<void (*)(const ScaleAddLinker<TData, dim, TDataScale>&)>() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("ScaleAddLinkerVectorMatrix"), dimTag); } // ScaleAddLinkerVectorVector { typedef MathVector<dim> TData; typedef MathVector<dim> TDataScale; typedef ScaleAddLinker<TData, dim, TDataScale, number> T; typedef DependentUserData<number, dim> TBase; string name = string("ScaleAddLinkerVectorVector").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<TDataScale,dim> > , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(number , SmartPtr<CplUserData<TData,dim> >)>(&T::add)) .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<TDataScale,dim> > , number)>(&T::add)) .add_method("add", static_cast<void (T::*)(number,number)>(&T::add)) .add_constructor() .template add_constructor<void (*)(const ScaleAddLinker<TData, dim, TDataScale,number>&)>() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("ScaleAddLinkerVectorVector"), dimTag); } // DarcyVelocityLinker { typedef DarcyVelocityLinker<dim> T; typedef DependentUserData<MathVector<dim>, dim> TBase; string name = string("DarcyVelocityLinker").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_method("set_gravity", &T::set_gravity) .add_method("set_permeability", static_cast<void (T::*)(number)>(&T::set_permeability)) .add_method("set_permeability", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim,dim>,dim> >)>(&T::set_permeability)) .add_method("set_pressure_gradient", &T::set_pressure_gradient) .add_method("set_viscosity", static_cast<void (T::*)(number)>(&T::set_viscosity)) .add_method("set_viscosity", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> >)>(&T::set_viscosity)) .add_method("set_density", static_cast<void (T::*)(number)>(&T::set_density)) .add_method("set_density", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> >)>(&T::set_density)) .add_constructor() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "DarcyVelocityLinker", dimTag); } // InverseLinker"Type" { typedef InverseLinker<dim> T; typedef DependentUserData<number,dim> TBase; string name = string("InverseLinker").append(dimSuffix); reg.add_class_<T,TBase>(name, grp) .add_method("divide", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> > , SmartPtr<CplUserData<number,dim> >)>(&T::divide)) .add_method("divide", static_cast<void (T::*)(number , SmartPtr<CplUserData<number,dim> >)>(&T::divide)) .add_method("divide", static_cast<void (T::*)(SmartPtr<CplUserData<number,dim> > , number)>(&T::divide)) .add_method("divide", static_cast<void (T::*)(number,number)>(&T::divide)) .add_constructor() .template add_constructor<void (*)(const InverseLinker<dim>&)>() .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("InverseLinker"), dimTag); } { typedef ug::LognormalRandomField<MathMatrix<dim, dim>, dim> T; typedef CplUserData<MathMatrix<dim, dim>, dim> TBase; string name = string("LognormalRandomField").append(dimSuffix);; reg.add_class_<T, TBase>(name, grp) //.add_constructor() .template add_constructor<void (*)()>("LognormalRandomField") .template add_constructor<void (*)(size_t N, double mean_f, double sigma_f, double sigma)>("LognormalRandomField", "N#mean_f#sigma_f#sigma") .add_method("set_config", &T::set_config, "", "N#mean_f#sigma_f#sigma") .add_method("set_no_exp", &T::set_no_exp, "", "", "use this for display of log of the field") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("LognormalRandomField"), dimTag); } // Inverse-distance-weighting interpolation { typedef IDWUserData<dim, number> T; typedef CplUserData<number, dim> TBase; string name = string("IDWUserData").append(dimSuffix); reg.add_class_<T, TBase>(name, grp) .add_method("load_data_from", static_cast<void (T::*)(const char*)>(&T::load_data_from), "loads data from a file", "file name") .add_method("set_order", static_cast<void (T::*)(number)>(&T::set_order), "sets order of the IDW-interpolation", "order") .add_method("set_radius", static_cast<void (T::*)(number)>(&T::set_radius), "sets radius of the neighbourhood for the IDW-interpolation", "radius") .add_constructor() .template add_constructor<void(*)(number,number)> ("order#radius") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "IDWUserData", dimTag); } }