Skip to content

Commit

Permalink
Merge commit 'ca96fdc0b59e27c3bd51baca8034c24bc347ae89' into feature-…
Browse files Browse the repository at this point in the history
…openmp

* commit 'ca96fdc0b59e27c3bd51baca8034c24bc347ae89': (58 commits)
  Arte 2D ready for use
  Revert "Merge pull request #96 from UG4/95-avoid-slicing"
  Member variable  m_passOnBehaviour now moved to abstract base. Menat to avoid slicing.
  NULL => nullptr
  Some cosmetics to the previous bug fix. Note that the bug fix is due to Shuai Lu.
  Bug fix: The bug prevented the subset handlers to be registered in the domain.
  Protecting LUA specific.
  An auxiliary function to check if a point is in a bounding box.
  Tools for conversion of different Lua types to ConstUserData objects.
  Add every status in PBS scheduler
  static asserts auskommentiert
  additional help classes for arte implementation
  Übertragen von arte24 auf master vorbereiten
  empty function to allow Jenkins to be successful
  removed static_asserts and other compiler warning reasons
  Bug fix: Releasing set but not cleared ip's in the local discretizations. ToDo: Should this be also done for the error estimators?
  Introducing the object names for the userdata class. This is a debugging facility.
  Restoring master version
  Revert "Merge branch 'master' into arte-merge"
  Fixing Out-of-line definition
  ...
  • Loading branch information
anaegel committed Nov 3, 2024
2 parents f5f52a9 + ca96fdc commit 8ca1ad4
Show file tree
Hide file tree
Showing 22 changed files with 9,225 additions and 81 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/jenkins-trigger.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
name: Trigger Jenkins CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel

jobs:
# This workflow contains a single job called "build"
build:
name: Build
trigger-jenkins-job:
runs-on: ubuntu-latest
steps:
- name: Trigger jenkins job
uses: anaegel/jenkins-githubaction@master
- id: triggerjenkinsjob
uses: mickeygoussetorg/trigger-jenkins-job@v1
with:
url: ${{ secrets.JENKINS_URL }}
job_name: ug-build-pipeline
username: ${{ secrets.JENKINS_USER }}
api_token: ${{ secrets.JENKINS_TOKEN }}
timeout: "3600"
interval: "300"
jenkins-server: ${{ secrets.JENKINS_URL }} # URL of the jenkins server. ex: http://myjenkins.acme.com:8080
jenkins-job: "ug-build-pipeline" # The name of the jenkins job to run
jenkins-username: ${{ secrets.JENKINS_USER }} # user name for accessing jenkins
jenkins-pat: ${{ secrets.JENKINS_TOKEN }} # personal Access token for accessing Jenkins
poll-time: 90 # how often (seconds) to poll the jenkins server for results
timeout-value: 3600 # How long (seconds) to poll before timing out the action
verbose: true # true/false - turns on extra logging
10 changes: 6 additions & 4 deletions scripts/shell/schedulers/pbs-generic
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function UJS_Submit


# PBSnodes="-l select=$nnodes:node_type=rome:mpiprocs=$nppn"
PBSnodes=""
PBSnodes="-l select=$nnodes:ncpus=$nppn:mpiprocs=$nppn"


if [ -z "$queue" ]; then
Expand Down Expand Up @@ -110,13 +110,15 @@ function UJS_Info
sub(/\..*$/, "", $1)
status = $10
if (status == "R") {
if (status == "R" || status == "E") {
status = "RUNNING"
} else if (status == "Q") {
} else if (status == "Q" || status == "H" || status == "W" || status == "T" || status == "S") {
status = "PENDING"
} else {
status = "PENDING"
}
print $1, $2, $3, $4, $5, $6, $7, $8, $9, status, $11
}' # change status to RUNNING or PENDING
}' # change every status to RUNNING or PENDING, fallback to PENDING
) | column -t # format output as table
}

Expand Down
102 changes: 86 additions & 16 deletions scripts/util/user_data_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,79 @@ function FreeUserData()
collectgarbage("collect")
end

--------------------------------------------------------------------------------
-- Conversion of types
--------------------------------------------------------------------------------

function ToUserNumber (o, my_dim)
if my_dim == nil then my_dim = GetUGDim() end

if type(o) == "number" then
return _G["ConstUserNumber"..my_dim.."d"](o)
elseif type(o) == "function" then
return _G["LuaUserNumber"..my_dim.."d"](o)
elseif type(o) == "string" then
return _G["LuaUserNumber"..my_dim.."d"](_G[o]) -- we assume a function as the argument
elseif type(o) == "userdata" then -- ToDo: Provide a better condition!
return o
end
return nil -- this indicates an error
end

function ToUserVector (o, my_dim)
if my_dim == nil then my_dim = GetUGDim() end

if type(o) == "table" then
return _G["ConstUserVector"..my_dim.."d"](o)
elseif type(o) == "function" then
return _G["LuaUserVector"..my_dim.."d"](o)
elseif type(o) == "string" then
return _G["LuaUserVector"..my_dim.."d"](_G[o]) -- we assume a function as the argument
elseif type(o) == "userdata" then -- ToDo: Provide a better condition!
return o
end
return nil -- this indicates an error
end

function __ug__CheckUserDataArgType(r, l)
function ToUserMatrix (o, my_dim)
if my_dim == nil then my_dim = GetUGDim() end

if type(o) == "number" then
return _G["ConstUserMatrix"..my_dim.."d"](o)
elseif type(o) == "table" then
local i, j
local m = _G["ConstUserMatrix"..my_dim.."d"]()
for i = 0, my_dim-1 do
if type(o[i+1]) ~= "table" then
print ("Illegal specification of a matrix by a table: Specify the rows as subtables.\n")
return nil
end
for j = 0, my_dim-1 do
local val = o [i+1] [j+1]
if type(val) ~= "number" then
print ("Illegal specification of a matrix by a table at (" .. i+1 .. ", " .. j+1 ..").\n")
return nil
end
m:set_entry (i, j, val)
end
end
return m
elseif type(o) == "function" then
return LuaUserMatrix(o)
elseif type(o) == "string" then
return LuaUserMatrix(_G[o])
elseif type(o) == "userdata" then -- ToDo: Provide a better condition!
return o
end
return nil -- this indicates an error
end

--------------------------------------------------------------------------------
---- Overloading Lua arithmetics operators for UserData
--------------------------------------------------------------------------------


local function __ug__CheckUserDataArgType(r, l)
local rType = ug_class_name(r)
local lType = ug_class_name(l)
local rDim = -1
Expand Down Expand Up @@ -175,11 +245,11 @@ function __ug__CheckUserDataArgType(r, l)
end

--------------------------------------------------------------------------------
-- Function to add/subtract UserData
-- Function to Add/Subtract UserData
--------------------------------------------------------------------------------

--! functions user when '+/-' is called on an UserData (or a derived implementation)
function __ug__UserNumber_sum(lScale, l, rScale, r)
local function __ug__UserNumber_sum(lScale, l, rScale, r)
local rType, lType, rDim, lDim, Dim, rData, lData, Data = __ug__CheckUserDataArgType(r, l)

if l == nil or r == nil then
Expand Down Expand Up @@ -253,12 +323,12 @@ function __ug__UserNumber_sum(lScale, l, rScale, r)
end

--! functions used when '+' is called on an UserData (or a derived implementation)
function __ug__UserNumber_add(l,r)
local function __ug__UserNumber_add(l,r)
return __ug__UserNumber_sum(1.0, l, 1.0, r)
end

--! functions used when '-' is called on an UserData (or a derived implementation)
function __ug__UserNumber_sub(l,r)
local function __ug__UserNumber_sub(l,r)
return __ug__UserNumber_sum(1.0, l, -1.0, r)
end

Expand All @@ -267,7 +337,7 @@ end
--------------------------------------------------------------------------------

--! functions user when '*' is called on an UserData (or a derived implementation)
function __ug__UserNumber_mul(l, r)
local function __ug__UserNumber_mul(l, r)
local rType, lType, rDim, lDim, Dim, rData, lData, Data = __ug__CheckUserDataArgType(r, l)

if l == nil or r == nil then
Expand Down Expand Up @@ -321,7 +391,7 @@ function __ug__UserNumber_mul(l, r)
end

--! functions user when '/' is called on an UserData (or a derived implementation)
function __ug__UserNumber_div(l, r)
local function __ug__UserNumber_div(l, r)
local rType, lType, rDim, lDim, Dim, rData, lData, Data = __ug__CheckUserDataArgType(r, l)

if l == nil or r == nil then
Expand Down Expand Up @@ -382,11 +452,11 @@ function __ug__UserNumber_div(l, r)
end

--------------------------------------------------------------------------------
-- Function to Multiply/Devide UserData
-- Function to Raise UserData to a power
--------------------------------------------------------------------------------

--! functions user when '^' is called on an UserData (or a derived implementation)
function __ug__UserNumber_pow(l, r)
local function __ug__UserNumber_pow(l, r)
if l == nil or r == nil then
error("Error in '^': nil value (possibly uninitialized value?)")
end
Expand Down Expand Up @@ -430,28 +500,28 @@ function __ug__UserNumber_pow(l, r)
end

--------------------------------------------------------------------------------
-- Loop to set the __add functions for UserData
-- Loop to set the arithmetic functions for UserData
--------------------------------------------------------------------------------

function set_user_data_overloads(name)
local function set_user_data_overloads(name)
-- request metatable for the classname
mt = ug_get_metatable(name)
if mt == nil then return end

-- set __add function in metatable
mt.__add = _G["__ug__UserNumber_add"]
mt.__add = __ug__UserNumber_add

-- set __sub function in metatable
mt.__sub = _G["__ug__UserNumber_sub"]
mt.__sub = __ug__UserNumber_sub

-- set __mul function in metatable
mt.__mul = _G["__ug__UserNumber_mul"]
mt.__mul = __ug__UserNumber_mul

-- set __div function in metatable
mt.__div = _G["__ug__UserNumber_div"]
mt.__div = __ug__UserNumber_div

-- set __pow function in metatable
mt.__pow = _G["__ug__UserNumber_pow"]
mt.__pow = __ug__UserNumber_pow
end

-- loop some kinds of UserData implementation
Expand Down
2 changes: 2 additions & 0 deletions ugbase/bindings/lua/lua_user_data_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#ifndef __H__UG_BRIDGE__BRIDGES__USER_DATA__USER_DATA_IMPL_
#define __H__UG_BRIDGE__BRIDGES__USER_DATA__USER_DATA_IMPL_

#ifdef UG_FOR_LUA
#include "lua_user_data.h"
#endif
#include "lib_disc/spatial_disc/user_data/linker/linker_traits.h"
#include "lib_disc/spatial_disc/user_data/const_user_data.h"

Expand Down
4 changes: 3 additions & 1 deletion ugbase/bridge/disc_bridges/user_data_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,9 @@ static void Common(Registry& reg, string grp)

// UserDataInfo
{
reg.add_class_<UserDataInfo>("UserDataInfo", grp);
reg.add_class_<UserDataInfo>("UserDataInfo", grp)
.add_method("set_obj_name", &UserDataInfo::set_obj_name)
.add_method("obj_name", &UserDataInfo::obj_name);
}

#ifdef UG_DIM_2
Expand Down
11 changes: 10 additions & 1 deletion ugbase/bridge/grid_bridges/file_io_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "lib_grid/multi_grid.h"
#include "lib_grid/file_io/file_io.h"
#include "lib_grid/file_io/file_io_ugx.h"
#include "lib_grid/file_io/file_io_vtu.h"

using namespace std;

Expand Down Expand Up @@ -77,6 +78,13 @@ bool SaveGridHierarchy(MultiGrid& mg, const char* filename)
return SaveGridToFile(mg, mg.get_hierarchy_handler(), filename);
}

void SetVTURegionOfInterestIdentifier( char const * regOfInt )
{
PROFILE_FUNC_GROUP("grid");
GridReaderVTU::setRegionOfInterestIdentifier( std::string( regOfInt ) );
return;
}


void RegisterGridBridge_FileIO(Registry& reg, string parentGroup)
{
Expand Down Expand Up @@ -129,7 +137,8 @@ void RegisterGridBridge_FileIO(Registry& reg, string parentGroup)
.add_function("SaveParallelGridLayout", &SaveParallelGridLayout,
grp, "", "mg#filename#offset")
.add_function("SaveSurfaceViewTransformed", &SaveSurfaceViewTransformed)
.add_function("SaveGridLevelToFile", &SaveGridLevelToFile);
.add_function("SaveGridLevelToFile", &SaveGridLevelToFile)
.add_function("SetVTURegionOfInterestIdentifier", static_cast<void (*)(char const *)>(&SetVTURegionOfInterestIdentifier) );
}

}// end of namespace
Expand Down
14 changes: 7 additions & 7 deletions ugbase/common/math/math_vector_matrix/math_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* UG4 is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License version 3 (as published by the
* Free Software Foundation) with the following additional attribution
* requirements (according to LGPL/GPL v3 ��7):
* requirements (according to LGPL/GPL v3 §7):
*
* (1) The following notice must be displayed in the Appropriate Legal Notices
* of covered and combined works: "Based on UG4 (www.ug4.org/license)".
Expand All @@ -20,7 +20,7 @@
* "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
* parallel geometric multigrid solver on hierarchically distributed grids.
* Computing and visualization in science 16, 4 (2013), 151-164"
* "Vogel, A., Reiter, S., Rupp, M., N��gel, A., and Wittum, G. UG4 -- a novel
* "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
* flexible software system for simulating pde based models on high performance
* computers. Computing and visualization in science 16, 4 (2013), 165-179"
*
Expand Down Expand Up @@ -101,7 +101,7 @@ class MathVector
static const std::size_t Size = N;

public:
MathVector() {for(std::size_t i = 0; i < N; ++i) m_data[i] = 0.0;}
MathVector() {for(std::size_t i = 0; i < N; ++i) m_data[i] = 0.0;}
MathVector(const value_type& val) {for(std::size_t i = 0; i < N; ++i) m_data[i] = val;}
MathVector(const MathVector& v) {assign(v);}

Expand Down Expand Up @@ -234,7 +234,7 @@ class MathVector<1, T>
static const std::size_t Size = 1;

public:
MathVector() {m_data[0] = 0.0; }
MathVector() {m_data[0] = 0.0;}
MathVector(value_type x) { m_data[0] = x; }
MathVector(const MathVector<1, T>& v) {assign(v);}

Expand Down Expand Up @@ -298,7 +298,7 @@ class MathVector<2, T>
static const std::size_t Size = 2;

public:
MathVector() { m_data[0] = m_data[1] = 0.0; }
MathVector() {m_data[0] = m_data[1] = 0.0;}
MathVector(const value_type& val) {m_data[0] = m_data[1] = val;}
MathVector(value_type x, value_type y)
{
Expand Down Expand Up @@ -370,7 +370,7 @@ class MathVector<3, T>
static const std::size_t Size = 3;

public:
MathVector() { m_data[0] = m_data[1] = m_data[2] = 0.0; }
MathVector() {m_data[0] = m_data[1] = m_data[2] = 0.0;}
MathVector(const value_type& val) {m_data[0] = m_data[1] = m_data[2] = val;}
MathVector(value_type x, value_type y, value_type z)
{
Expand Down Expand Up @@ -448,7 +448,7 @@ class MathVector<4, T>
static const std::size_t Size = 4;

public:
MathVector() {m_data[0] = m_data[1] = m_data[2] = m_data[3] =0.0;}
MathVector() {m_data[0] = m_data[1] = m_data[2] = m_data[3] = 0.0;}
MathVector(const value_type& val) {m_data[0] = m_data[1] = m_data[2] = m_data[3] =val;}
MathVector(value_type x, value_type y, value_type z, value_type w)
{
Expand Down
6 changes: 6 additions & 0 deletions ugbase/common/math/math_vector_matrix/math_vector_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,12 @@ inline
bool
VecAbsIsLess(const vector_t& v1, const typename vector_t::value_type s);

/// checks if the given point is in the bounding box given by two other points
template <typename vector_t>
inline
bool
VecIsInBB(const vector_t& v, const vector_t& low, const vector_t& high);

}// end of namespace

////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,18 @@ VecAbsIsLess(const vector_t& v1, const typename vector_t::value_type s)
return true;
}

/// checks if the given point is in the bounding box given by two other points
template <typename vector_t>
inline
bool
VecIsInBB(const vector_t& v, const vector_t& low, const vector_t& high)
{
for(typename vector_t::size_type i = 0; i < v.size(); ++i)
if (v[i] < low[i] || high[i] < v[i])
return false;
return true;
}

}// end of namespace

#endif /* __H__COMMON__MathVector_FUNCTIONS_COMMON_IMPL__ */
Expand Down
Loading

0 comments on commit 8ca1ad4

Please sign in to comment.