Merge branch 'add_ngs_array' into 'master'

Add ngs array

See merge request jschoeberl/netgen!173
This commit is contained in:
Joachim Schöberl 2019-07-10 14:43:47 +00:00
commit 9357ad1e78
199 changed files with 9514 additions and 2176 deletions

View File

@ -6,7 +6,7 @@ if(WIN32)
# we are linking to object libraries on Windows
cmake_minimum_required(VERSION 3.12)
else(WIN32)
cmake_minimum_required(VERSION 3.1.3)
cmake_minimum_required(VERSION 3.8)
endif(WIN32)
if(NOT WIN32)
@ -115,6 +115,7 @@ endif (ADDITIONAL_PATHS)
#######################################################################
# build options
include_directories ("${PROJECT_SOURCE_DIR}/include")
include_directories ("${PROJECT_SOURCE_DIR}/libsrc")
include_directories ("${PROJECT_SOURCE_DIR}/libsrc/include")
include_directories ("${PROJECT_BINARY_DIR}")
@ -216,7 +217,7 @@ macro(get_dll_from_lib dll_path lib_path)
get_filename_component(lib_name ${lib} name)
endmacro()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
if(WIN32)
get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX)
@ -287,13 +288,20 @@ if (USE_PYTHON)
endif (USE_PYTHON)
#######################################################################
add_library(netgen_mpi INTERFACE)
add_library(netgen_metis INTERFACE)
if (USE_MPI)
find_package(MPI REQUIRED)
target_include_directories(netgen_mpi INTERFACE ${MPI_CXX_INCLUDE_PATH})
target_link_libraries(netgen_mpi INTERFACE ${MPI_mpi_LIBRARY} ${MPI_CXX_LIBRARIES} )
target_compile_definitions(netgen_mpi INTERFACE PARALLEL )
find_package(METIS REQUIRED)
add_definitions(-DPARALLEL -DMETIS)
include_directories(${MPI_CXX_INCLUDE_PATH})
include_directories(${METIS_INCLUDE_DIR})
target_include_directories(netgen_metis INTERFACE ${METIS_INCLUDE_DIR})
target_link_libraries(netgen_metis INTERFACE ${METIS_LIBRARY} )
target_compile_definitions(netgen_metis INTERFACE METIS )
endif (USE_MPI)
install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR})
#######################################################################
if (USE_OCC)

View File

@ -1,5 +1,13 @@
add_library(ngcore SHARED archive.cpp logging.cpp paje_trace.cpp utils.cpp profiler.cpp)
add_library(ngcore SHARED
archive.cpp
localheap.cpp
logging.cpp
paje_trace.cpp
profiler.cpp
taskmanager.cpp
utils.cpp
)
target_compile_definitions(ngcore PRIVATE NGCORE_EXPORTS)
if(NOT WIN32)
@ -31,9 +39,11 @@ if(USE_PYTHON)
target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES})
endif(USE_PYTHON)
target_link_libraries(ngcore PUBLIC netgen_mpi PRIVATE ${CMAKE_THREAD_LIBS_INIT})
install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp
exception.hpp symboltable.hpp paje_trace.hpp utils.hpp profiler.hpp mpi_wrapper.hpp
array.hpp taskmanager.hpp concurrentqueue.h localheap.hpp
DESTINATION ${NG_INSTALL_DIR_INCLUDE}/core COMPONENT netgen_devel)
if(ENABLE_CPP_CORE_GUIDELINES_CHECK)

1477
libsrc/core/array.hpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

72
libsrc/core/localheap.cpp Normal file
View File

@ -0,0 +1,72 @@
/**************************************************************************/
/* File: localheap.cpp */
/* Author: Joachim Schoeberl */
/* Date: 19. Apr. 2002 */
/**************************************************************************/
#include <exception>
#include <string>
#include "localheap.hpp"
#include "taskmanager.hpp"
namespace ngcore
{
LocalHeap :: LocalHeap (size_t asize, const char * aname, bool mult_by_threads)
{
if (mult_by_threads)
asize *= TaskManager::GetMaxThreads();
totsize = asize;
try
{
data = new char[asize];
}
catch (std::exception & e)
{
throw Exception (ToString ("Could not allocate localheap, heapsize = ") + ToString(asize));
}
next = data + totsize;
p = data;
owner = true;
name = aname;
CleanUp(); // align pointer
}
LocalHeap LocalHeap :: Split() const
{
int pieces = TaskManager::GetNumThreads();
int i = TaskManager::GetThreadId();
size_t freemem = totsize - (p - data);
size_t size_of_piece = freemem / pieces;
return LocalHeap (p + i * size_of_piece, size_of_piece, name);
}
void LocalHeap :: ThrowException() // throw (LocalHeapOverflow)
{
/*
cout << "allocated: " << (p-data) << endl;
cout << "throw LocalHeapOverflow, totsize = "<< totsize << endl;
cout << "heap name = " << name << endl;
*/
throw LocalHeapOverflow(totsize);
}
LocalHeapOverflow :: LocalHeapOverflow (size_t size)
: Exception("Local Heap overflow\n")
{
std::stringstream str;
str << "Current heapsize is " << size << '\n';
Append (str.str());
// Append ("please use 'define constant heapsize = xxx' with larger value\n");
}
LocalHeapOverflow :: ~LocalHeapOverflow ()
{
;
}
}

318
libsrc/core/localheap.hpp Normal file
View File

@ -0,0 +1,318 @@
#ifndef NETGEN_CORE_LOCALHEAP_HPP
#define NETGEN_CORE_LOCALHEAP_HPP
/**************************************************************************/
/* File: localheap.hpp */
/* Author: Joachim Schoeberl */
/* Date: 19. Apr. 2000 */
/**************************************************************************/
#include <cstdlib>
#include "exception.hpp"
#include "ngcore_api.hpp"
#include "utils.hpp"
namespace ngcore
{
class Allocator
{
public:
virtual ~Allocator() {}
virtual void * Alloc (size_t size)
{
return new char[size];
}
virtual void Delete(void* p)
{
delete (char*) p;
}
virtual void ArrayDelete(void* p)
{
delete [] (char*) p;
}
};
static Allocator global_alloc;
/**
Exception on heap overflow.
Thrown by allocation on LocalHeap.
*/
class NGCORE_API LocalHeapOverflow : public Exception
{
public:
LocalHeapOverflow (size_t size);
virtual ~LocalHeapOverflow ();
};
/**
Optimized memory handler.
One block of data is organized as stack memory.
One can allocate memory out of it. This increases the stack pointer.
With \Ref{CleanUp}, the pointer is reset to the beginning or to a
specific position.
*/
class LocalHeap : public Allocator
{
char * data;
char * next;
char * p;
size_t totsize;
public:
bool owner;
const char * name;
#if defined(__MIC__) || defined (__AVX512F__)
enum { ALIGN = 64 };
#else
enum { ALIGN = 32 };
#endif
public:
/// Allocate one block of size asize.
NGCORE_API LocalHeap (size_t asize,
const char * aname = "noname",
bool mult_by_threads = false);
/// Use provided memory for the LocalHeap
NETGEN_INLINE LocalHeap (char * adata, size_t asize,
const char * aname = "noname") throw ()
{
totsize = asize;
data = adata;
next = data + totsize;
owner = 0;
// p = data;
name = aname;
CleanUp();
}
/*
/// Use provided memory for the LocalHeap
NETGEN_INLINE LocalHeap (const LocalHeap & lh2)
: data(lh2.data), p(lh2.p), totsize(lh2.totsize), owner(false),
name(lh2.name)
{
next = data + totsize;
}
*/
NETGEN_INLINE LocalHeap (const LocalHeap & lh2) = delete;
NETGEN_INLINE LocalHeap (LocalHeap && lh2)
: data(lh2.data), p(lh2.p), totsize(lh2.totsize), owner(lh2.owner),
name(lh2.name)
{
next = data + totsize;
lh2.owner = false;
}
NETGEN_INLINE LocalHeap Borrow()
{
return LocalHeap (p, Available());
}
NETGEN_INLINE LocalHeap & operator= (LocalHeap && lh2)
{
if (owner)
delete [] data;
data = lh2.data;
p = lh2.p;
totsize = lh2.totsize;
owner = lh2.owner;
name = lh2.name;
next = data + totsize;
lh2.owner = false;
return *this;
}
NETGEN_INLINE LocalHeap ()
: data(nullptr), next(nullptr), p(nullptr), totsize(0), owner(false) { ; }
/// free memory
NETGEN_INLINE virtual ~LocalHeap ()
{
if (owner)
delete [] data;
}
/// delete all memory on local heap
NETGEN_INLINE void CleanUp() throw ()
{
p = data;
// p += (16 - (long(p) & 15) );
p += (ALIGN - (size_t(p) & (ALIGN-1) ) );
}
/// returns heap-pointer
NETGEN_INLINE void * GetPointer () throw ()
{
return p;
}
/// deletes memory back to heap-pointer
NETGEN_INLINE void CleanUp (void * addr) throw ()
{
p = (char*)addr;
}
/// allocates size bytes of memory from local heap
NETGEN_INLINE void * Alloc (size_t size) final // throw (LocalHeapOverflow)
{
char * oldp = p;
// 16 byte alignment
size += (ALIGN - size % ALIGN);
p += size;
// if ( size_t(p - data) >= totsize )
#ifndef FULLSPEED
if (likely(p >= next))
ThrowException();
#endif
return oldp;
}
/// allocates size objects of type T on local heap
template <typename T>
NETGEN_INLINE T * Alloc (size_t size) // throw (LocalHeapOverflow)
{
char * oldp = p;
size *= sizeof (T);
// 16 byte alignment
size += (ALIGN - size % ALIGN);
p += size;
#ifndef FULLSPEED
if (likely(p >= next))
ThrowException();
#endif
return reinterpret_cast<T*> (oldp);
}
virtual void Delete(void* p) {}
virtual void ArrayDelete(void* p) {}
private:
///
#ifndef __CUDA_ARCH__
[[noreturn]] NGCORE_API void ThrowException();
#else
NETGEN_INLINE void ThrowException() { ; }
#endif
public:
/// free memory (dummy function)
NETGEN_INLINE void Free (void * data) throw ()
{
;
}
/// available memory on LocalHeap
NETGEN_INLINE size_t Available () const throw () { return (totsize - (p-data)); }
/// Split free memory on heap into pieces for each thread
NGCORE_API LocalHeap Split () const;
/// Split free memory on heap into pieces
NETGEN_INLINE LocalHeap Split (int partnr, int nparts) const
{
int pieces = nparts;
int i = partnr;
size_t freemem = totsize - (p - data);
size_t size_of_piece = freemem / pieces;
return LocalHeap (p + i * size_of_piece, size_of_piece, name);
}
NETGEN_INLINE void ClearValues ()
{
for (size_t i = 0; i < totsize; i++) data[i] = 47;
}
NETGEN_INLINE size_t UsedSize ()
{
for (size_t i = totsize-1; i != 0; i--)
if (data[i] != 47) return i;
return 0;
}
};
/**
Optimized memory handler.
Provides static memory for the local heap. The template argument specifies the size in number of chars.
*/
template <int S>
class LocalHeapMem : public LocalHeap
{
char mem[S];
public:
NETGEN_INLINE LocalHeapMem (const char * aname) throw () : LocalHeap (mem, S, aname) { ; }
};
/**
A reset for the heap-pointer of a LocalHeap..
The constructor stores the heap-pointer, the constructor at the end of the regions resets the heap-pointer.
*/
class HeapReset
{
LocalHeap & lh;
void * pointer;
public:
///
NETGEN_INLINE HeapReset (LocalHeap & alh)
: lh(alh), pointer (alh.GetPointer()) { ; }
///
NETGEN_INLINE ~HeapReset ()
{
lh.CleanUp (pointer);
}
};
}
NETGEN_INLINE void * operator new (size_t size, ngcore::Allocator & alloc)
{
return alloc.Alloc(size);
}
NETGEN_INLINE void * operator new [] (size_t size, ngcore::Allocator & alloc)
{
return alloc.Alloc(size);
}
NETGEN_INLINE void operator delete (void * p, ngcore::Allocator & lh)
{
lh.Delete(p);
}
NETGEN_INLINE void operator delete [] (void * p, ngcore::Allocator & lh)
{
lh.ArrayDelete(p);
}
#endif // NETGEN_CORE_LOCALHEAP_HPP

View File

@ -6,6 +6,7 @@
#include <mpi.h>
#endif
#include "exception.hpp"
namespace ngcore
{
@ -191,7 +192,7 @@ namespace ngcore
};
#else
#else // PARALLEL
class MPI_Comm {
int nr;
public:
@ -240,7 +241,7 @@ namespace ngcore
void Bcast (T & s, int root = 0) const { ; }
};
#endif
#endif // PARALLEL
@ -252,5 +253,5 @@ namespace ngcore
}
#endif
#endif // NGCORE_MPIWRAPPER_HPP

View File

@ -2,11 +2,14 @@
#define NETGEN_CORE_NGCORE_HPP
#include "archive.hpp"
#include "array.hpp"
#include "exception.hpp"
#include "localheap.hpp"
#include "logging.hpp"
#include "mpi_wrapper.hpp"
#include "profiler.hpp"
#include "symboltable.hpp"
#include "taskmanager.hpp"
#include "version.hpp"
#include "mpi_wrapper.hpp"
#endif // NETGEN_CORE_NGCORE_HPP

809
libsrc/core/taskmanager.cpp Normal file
View File

@ -0,0 +1,809 @@
/********************************************************************/
/* File: taskmanager.cpp */
/* Author: M. Hochsterger, J. Schoeberl */
/* Date: 10. Mar. 2015 */
/********************************************************************/
#include <thread>
#include <atomic>
#include <mutex>
#include <chrono>
#include "concurrentqueue.h"
#include "mpi_wrapper.hpp"
#include "paje_trace.hpp"
#include "profiler.hpp"
#include "taskmanager.hpp"
#ifdef USE_MKL
#include <mkl.h>
#endif
namespace ngcore
{
using std::mutex;
using std::lock_guard;
using std::memory_order_release;
using std::memory_order_relaxed;
using std::make_tuple;
TaskManager * task_manager = nullptr;
bool TaskManager :: use_paje_trace = false;
int TaskManager :: max_threads = getenv("NGS_NUM_THREADS") ? atoi(getenv("NGS_NUM_THREADS")) : std::thread::hardware_concurrency();
int TaskManager :: num_threads = 1;
#ifndef __clang__
thread_local int TaskManager :: thread_id = 0;
#else
__thread int TaskManager :: thread_id;
#endif
const function<void(TaskInfo&)> * TaskManager::func;
const function<void()> * TaskManager::startup_function = nullptr;
const function<void()> * TaskManager::cleanup_function = nullptr;
atomic<int> TaskManager::ntasks;
Exception * TaskManager::ex;
atomic<int> TaskManager::jobnr;
atomic<int> TaskManager::complete[8]; // max nodes
atomic<int> TaskManager::done;
atomic<int> TaskManager::active_workers;
atomic<int> TaskManager::workers_on_node[8]; // max nodes
int TaskManager::sleep_usecs = 1000;
bool TaskManager::sleep = false;
TaskManager::NodeData *TaskManager::nodedata[8];
int TaskManager::num_nodes;
static mutex copyex_mutex;
int EnterTaskManager ()
{
if (task_manager)
{
// no task manager started
return 0;
}
task_manager = new TaskManager();
// TODO: use logger for output
std::cout << "task-based parallelization (C++11 threads) using "<< task_manager->GetNumThreads() << " threads" << std::endl;
#ifdef USE_NUMA
numa_run_on_node (0);
#endif
#ifndef WIN32
// master has maximal priority !
int policy;
struct sched_param param;
pthread_getschedparam(pthread_self(), &policy, &param);
param.sched_priority = sched_get_priority_max(policy);
pthread_setschedparam(pthread_self(), policy, &param);
#endif // WIN32
task_manager->StartWorkers();
ParallelFor (Range(100), [&] (int i) { ; }); // startup
return task_manager->GetNumThreads();
}
void ExitTaskManager (int num_threads)
{
if(num_threads > 0)
{
task_manager->StopWorkers();
delete task_manager;
task_manager = nullptr;
}
}
void RunWithTaskManager (function<void()> alg)
{
int num_threads = EnterTaskManager();
alg();
ExitTaskManager(num_threads);
}
void TaskManager :: SetNumThreads(int amax_threads)
{
if(task_manager && task_manager->active_workers>0)
{
std::cerr << "Warning: can't change number of threads while TaskManager active!" << std::endl;
return;
}
max_threads = amax_threads;
}
TaskManager :: TaskManager()
{
num_threads = GetMaxThreads();
// if (MyMPI_GetNTasks() > 1) num_threads = 1;
#ifdef USE_NUMA
numa_available();
num_nodes = numa_max_node() + 1;
if (num_nodes > num_threads) num_nodes = num_threads;
for (int j = 0; j < num_nodes; j++)
{
void * mem = numa_alloc_onnode (sizeof(NodeData), j);
nodedata[j] = new (mem) NodeData;
complete[j] = -1;
workers_on_node[j] = 0;
}
#else
num_nodes = 1;
nodedata[0] = new NodeData;
complete[0] = -1;
workers_on_node[0] = 0;
#endif
jobnr = 0;
done = 0;
sleep = false;
sleep_usecs = 1000;
active_workers = 0;
static int cnt = 0;
char buf[100];
if (use_paje_trace)
{
#ifdef PARALLEL
int is_init = -1;
MPI_Initialized(&is_init);
if (is_init)
sprintf(buf, "ng%d_rank%d.trace", cnt++, NgMPI_Comm(MPI_COMM_WORLD).Rank());
else
#endif
sprintf(buf, "ng%d.trace", cnt++);
}
else
buf[0] = 0;
//sprintf(buf, "");
trace = new PajeTrace(num_threads, buf);
}
TaskManager :: ~TaskManager ()
{
delete trace;
trace = nullptr;
num_threads = 1;
}
int TaskManager :: GetThreadId()
{
return thread_id;
}
void TaskManager :: StartWorkers()
{
done = false;
for (int i = 1; i < num_threads; i++)
{
std::thread([this,i]() { this->Loop(i); }).detach();
}
thread_id = 0;
size_t alloc_size = num_threads*NgProfiler::SIZE;
NgProfiler::thread_times = new size_t[alloc_size];
for (size_t i = 0; i < alloc_size; i++)
NgProfiler::thread_times[i] = 0;
NgProfiler::thread_flops = new size_t[alloc_size];
for (size_t i = 0; i < alloc_size; i++)
NgProfiler::thread_flops[i] = 0;
while (active_workers < num_threads-1)
;
}
static size_t calibrate_init_tsc = __rdtsc();
typedef std::chrono::system_clock TClock;
static TClock::time_point calibrate_init_clock = TClock::now();
void TaskManager :: StopWorkers()
{
done = true;
double delta_tsc = __rdtsc()-calibrate_init_tsc;
double delta_sec = std::chrono::duration<double>(TClock::now()-calibrate_init_clock).count();
double frequ = (delta_sec != 0) ? delta_tsc/delta_sec : 2.7e9;
// cout << "cpu frequ = " << frequ << endl;
// collect timings
for (size_t i = 0; i < num_threads; i++)
for (size_t j = NgProfiler::SIZE; j-- > 0; )
{
if (!NgProfiler::timers[j].usedcounter) break;
NgProfiler::timers[j].tottime += 1.0/frequ * NgProfiler::thread_times[i*NgProfiler::SIZE+j];
NgProfiler::timers[j].flops += NgProfiler::thread_flops[i*NgProfiler::SIZE+j];
}
delete [] NgProfiler::thread_times;
NgProfiler::thread_times = NgProfiler::dummy_thread_times.data();
delete [] NgProfiler::thread_flops;
NgProfiler::thread_flops = NgProfiler::dummy_thread_flops.data();
while (active_workers)
;
}
/////////////////////// NEW: nested tasks using concurrent queue
struct TNestedTask
{
const function<void(TaskInfo&)> * func;
atomic<int> * endcnt;
int mynr;
int total;
TNestedTask () { ; }
TNestedTask (const function<void(TaskInfo&)> & _func,
int _mynr, int _total,
atomic<int> & _endcnt)
: func(&_func), mynr(_mynr), total(_total), endcnt(&_endcnt)
{
;
}
};
typedef moodycamel::ConcurrentQueue<TNestedTask> TQueue;
typedef moodycamel::ProducerToken TPToken;
typedef moodycamel::ConsumerToken TCToken;
static TQueue taskqueue;
void AddTask (const function<void(TaskInfo&)> & afunc,
atomic<int> & endcnt)
{
TPToken ptoken(taskqueue);
int num = endcnt;
for (int i = 0; i < num; i++)
taskqueue.enqueue (ptoken, { afunc, i, num, endcnt });
}
mutex m;
bool ProcessTask()
{
TNestedTask task;
TCToken ctoken(taskqueue);
if (taskqueue.try_dequeue(ctoken, task))
{
TaskInfo ti;
ti.task_nr = task.mynr;
ti.ntasks = task.total;
ti.thread_nr = TaskManager::GetThreadId();
ti.nthreads = TaskManager::GetNumThreads();
/*
{
lock_guard<mutex> guard(m);
cout << "process nested, nr = " << ti.task_nr << "/" << ti.ntasks << endl;
}
*/
(*task.func)(ti);
--*task.endcnt;
return true;
}
return false;
}
void TaskManager :: CreateJob (const function<void(TaskInfo&)> & afunc,
int antasks)
{
if (num_threads == 1 || !task_manager) // || func)
{
if (startup_function) (*startup_function)();
TaskInfo ti;
ti.ntasks = antasks;
ti.thread_nr = 0; ti.nthreads = 1;
// ti.node_nr = 0; ti.nnodes = 1;
for (ti.task_nr = 0; ti.task_nr < antasks; ti.task_nr++)
afunc(ti);
if (cleanup_function) (*cleanup_function)();
return;
}
if (func)
{ // we are already parallel, use nested tasks
// startup for inner function not supported ...
// if (startup_function) (*startup_function)();
if (antasks == 1)
{
TaskInfo ti;
ti.task_nr = 0;
ti.ntasks = 1;
ti.thread_nr = 0; ti.nthreads = 1;
afunc(ti);
return;
}
atomic<int> endcnt(antasks);
AddTask (afunc, endcnt);
while (endcnt > 0)
{
ProcessTask();
}
// if (cleanup_function) (*cleanup_function)();
return;
}
trace->StartJob(jobnr, afunc.target_type());
func = &afunc;
ntasks.store (antasks); // , memory_order_relaxed);
ex = nullptr;
nodedata[0]->start_cnt.store (0, memory_order_relaxed);
jobnr++;
for (int j = 0; j < num_nodes; j++)
nodedata[j]->participate |= 1;
if (startup_function) (*startup_function)();
int thd = 0;
int thds = GetNumThreads();
int mynode = num_nodes * thd/thds;
IntRange mytasks = Range(int(ntasks)).Split (mynode, num_nodes);
NodeData & mynode_data = *(nodedata[mynode]);
TaskInfo ti;
ti.nthreads = thds;
ti.thread_nr = thd;
// ti.nnodes = num_nodes;
// ti.node_nr = mynode;
try
{
while (1)
{
int mytask = mynode_data.start_cnt++;
if (mytask >= mytasks.Size()) break;
ti.task_nr = mytasks.First()+mytask;
ti.ntasks = ntasks;
{
RegionTracer t(ti.thread_nr, jobnr, RegionTracer::ID_JOB, ti.task_nr);
(*func)(ti);
}
}
}
catch (Exception e)
{
{
lock_guard<mutex> guard(copyex_mutex);
delete ex;
ex = new Exception (e);
mynode_data.start_cnt = mytasks.Size();
}
}
if (cleanup_function) (*cleanup_function)();
for (int j = 0; j < num_nodes; j++)
if (workers_on_node[j])
{
while (complete[j] != jobnr)
_mm_pause();
}
func = nullptr;
if (ex)
throw Exception (*ex);
trace->StopJob();
}
void TaskManager :: Loop(int thd)
{
/*
static Timer tADD("add entry counter");
static Timer tCASready1("spin-CAS ready tick1");
static Timer tCASready2("spin-CAS ready tick2");
static Timer tCASyield("spin-CAS yield");
static Timer tCAS1("spin-CAS wait");
static Timer texit("exit zone");
static Timer tdec("decrement");
*/
thread_id = thd;
int thds = GetNumThreads();
int mynode = num_nodes * thd/thds;
NodeData & mynode_data = *(nodedata[mynode]);
TaskInfo ti;
ti.nthreads = thds;
ti.thread_nr = thd;
// ti.nnodes = num_nodes;
// ti.node_nr = mynode;
#ifdef USE_NUMA
numa_run_on_node (mynode);
#endif
active_workers++;
workers_on_node[mynode]++;
int jobdone = 0;
#ifdef USE_MKL
auto mkl_max = mkl_get_max_threads();
mkl_set_num_threads_local(1);
#endif
while (!done)
{
if (complete[mynode] > jobdone)
jobdone = complete[mynode];
if (jobnr == jobdone)
{
// RegionTracer t(ti.thread_nr, tCASyield, ti.task_nr);
while (ProcessTask()); // do the nested tasks
if(sleep)
std::this_thread::sleep_for(std::chrono::microseconds(sleep_usecs));
else
{
#ifdef WIN32
std::this_thread::yield();
#else // WIN32
sched_yield();
#endif // WIN32
}
continue;
}
{
// RegionTracer t(ti.thread_nr, tADD, ti.task_nr);
// non-atomic fast check ...
if ( (mynode_data.participate & 1) == 0) continue;
int oldval = mynode_data.participate += 2;
if ( (oldval & 1) == 0)
{ // job not active, going out again
mynode_data.participate -= 2;
continue;
}
}
if (startup_function) (*startup_function)();
IntRange mytasks = Range(int(ntasks)).Split (mynode, num_nodes);
try
{
while (1)
{
if (mynode_data.start_cnt >= mytasks.Size()) break;
int mytask = mynode_data.start_cnt.fetch_add(1, memory_order_relaxed);
if (mytask >= mytasks.Size()) break;
ti.task_nr = mytasks.First()+mytask;
ti.ntasks = ntasks;
{
RegionTracer t(ti.thread_nr, jobnr, RegionTracer::ID_JOB, ti.task_nr);
(*func)(ti);
}
}
}
catch (Exception e)
{
{
// cout << "got exception in TM" << endl;
lock_guard<mutex> guard(copyex_mutex);
delete ex;
ex = new Exception (e);
mynode_data.start_cnt = mytasks.Size();
}
}
#ifndef __MIC__
atomic_thread_fence (memory_order_release);
#endif // __MIC__
if (cleanup_function) (*cleanup_function)();
jobdone = jobnr;
mynode_data.participate-=2;
{
int oldpart = 1;
if (mynode_data.participate.compare_exchange_strong (oldpart, 0))
{
if (jobdone < jobnr.load())
{ // reopen gate
mynode_data.participate |= 1;
}
else
{
if (mynode != 0)
mynode_data.start_cnt = 0;
complete[mynode] = jobnr.load();
}
}
}
}
#ifdef USE_MKL
mkl_set_num_threads_local(mkl_max);
#endif
workers_on_node[mynode]--;
active_workers--;
}
std::list<std::tuple<std::string,double>> TaskManager :: Timing ()
{
/*
list<tuple<string,double>>timings;
double time =
RunTiming
( [&] ()
{
ParallelJob ( [] (TaskInfo ti) { ; } ,
TasksPerThread(1) );
});
timings.push_back (make_tuple("parallel job with 1 task per thread", time*1e9));
time =
RunTiming
( [&] ()
{
ParallelJob ( [] (TaskInfo ti) { ; } ,
TasksPerThread(10) );
});
timings.push_back (make_tuple("parallel job with 10 tasks per thread", time*1e9));
time =
RunTiming
( [&] ()
{
ParallelJob ( [] (TaskInfo ti) { ; } ,
TasksPerThread(100) );
});
timings.push_back (make_tuple("parallel job with 100 tasks per thread", time*1e9));
return timings;
*/
// this is the old function moved from the py-interface:
std::list<std::tuple<std::string,double>>timings;
double starttime, time;
double maxtime = 0.5;
size_t steps;
starttime = WallTime();
steps = 0;
do
{
for (size_t i = 0; i < 1000; i++)
ParallelJob ( [] (TaskInfo ti) { ; },
TasksPerThread(1));
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("ParallelJob 1 task/thread", time/steps*1e9));
starttime = WallTime();
steps = 0;
do
{
for (size_t i = 0; i < 1000; i++)
ParallelJob ( [] (TaskInfo ti) { ; },
TasksPerThread(100));
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("ParallelJob 100 task/thread", time/steps*1e9));
starttime = WallTime();
steps = 0;
do
{
for (int k = 0; k < 10000; k++)
{
SharedLoop2 sl(1000);
steps += 1;
}
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("SharedLoop init", time/steps*1e9));
starttime = WallTime();
steps = 0;
do
{
for (int k = 0; k < 1000; k++)
{
SharedLoop sl(5);
ParallelJob ( [&sl] (TaskInfo ti)
{
for (auto i : sl)
(void)i; // silence warning
} );
}
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("short SharedLoop", time/steps*1e9));
starttime = WallTime();
steps = 0;
do
{
for (int k = 0; k < 1000; k++)
{
SharedLoop sl1(5), sl2(5), sl3(5), sl4(5), sl5(5);
ParallelJob ( [&sl1, &sl2, &sl3, &sl4, &sl5] (TaskInfo ti)
{
for (auto i : sl1)
(void)i; // silence warning
for (auto i : sl2)
(void)i; // silence warning
for (auto i : sl3)
(void)i; // silence warning
for (auto i : sl4)
(void)i; // silence warning
for (auto i : sl5)
(void)i; // silence warning
} );
}
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("5 short SharedLoops", time/steps*1e9));
starttime = WallTime();
steps = 0;
SharedLoop2 sl2(5);
do
{
for (int k = 0; k < 1000; k++)
{
sl2.Reset(5);
ParallelJob ( [&sl2] (TaskInfo ti)
{
for (auto i : sl2)
(void)i; // silence warning
} );
}
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("short SharedLoop2", time/steps*1e9));
{
starttime = WallTime();
steps = 0;
SharedLoop2 sl1(5), sl2(5), sl3(5), sl4(5), sl5(5);
do
{
for (int k = 0; k < 1000; k++)
{
sl1.Reset(5);
sl2.Reset(5);
sl3.Reset(5);
sl4.Reset(5);
sl5.Reset(5);
ParallelJob ( [&sl1,&sl2,&sl3,&sl4,&sl5] (TaskInfo ti)
{
for (auto i : sl1)
(void)i; // silence warning
for (auto i : sl2)
(void)i; // silence warning
for (auto i : sl3)
(void)i; // silence warning
for (auto i : sl4)
(void)i; // silence warning
for (auto i : sl5)
(void)i; // silence warning
} );
}
steps += 1000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("5 short SharedLoop2", time/steps*1e9));
}
starttime = WallTime();
steps = 0;
{
SharedLoop2 sl(1000);
do
{
for (int k = 0; k < 1000; k++)
{
sl.Reset(1000);
ParallelJob ( [&sl] (TaskInfo ti)
{
for (auto i : sl)
(void)i; // silence warning
} );
steps += 1000;
}
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("SharedLoop2 1000, time per iteration", time/steps*1e9));
}
{
starttime = WallTime();
steps = 0;
SharedLoop2 sl(1000000);
do
{
sl.Reset(1000000);
ParallelJob ( [&sl] (TaskInfo ti)
{
for (auto i : sl)
(void)i; // silence warning
} );
steps += 1000000;
time = WallTime()-starttime;
}
while (time < maxtime);
timings.push_back(make_tuple("SharedLoop2 1000000, time per iteration", time/steps*1e9));
}
return timings;
}
}

1021
libsrc/core/taskmanager.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -65,6 +65,44 @@ namespace ngcore
ost << "\n" << val.first << ": " << val.second;
return ost;
}
template <class T>
NETGEN_INLINE void Swap (T & a, T & b)
{
T temp = std::move(a);
a = std::move(b);
b = std::move(temp);
}
template <typename T>
class AlignedAlloc
{
protected:
static void * aligned_malloc(size_t s)
{
// Assume 16 byte alignment of standard library
if(alignof(T)<=16)
return malloc(s);
else
return _mm_malloc(s, alignof(T));
}
static void aligned_free(void *p)
{
if(alignof(T)<=16)
free(p);
else
_mm_free(p);
}
public:
void * operator new (size_t s, void *p) { return p; }
void * operator new (size_t s) { return aligned_malloc(s); }
void * operator new[] (size_t s) { return aligned_malloc(s); }
void operator delete (void * p) { aligned_free(p); }
void operator delete[] (void * p) { aligned_free(p); }
};
} // namespace ngcore
#endif // NETGEN_CORE_UTILS_HPP

View File

@ -116,7 +116,7 @@ namespace netgen
void Plane :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const
NgArray<double> & coeffs) const
{
classname = "plane";
coeffs.SetSize (6);
@ -128,7 +128,7 @@ namespace netgen
coeffs.Elem(6) = n(2);
}
void Plane :: SetPrimitiveData (Array<double> & coeffs)
void Plane :: SetPrimitiveData (NgArray<double> & coeffs)
{
p(0) = coeffs.Elem(1);
p(1) = coeffs.Elem(2);
@ -367,7 +367,7 @@ namespace netgen
c1 = (c(0) * c(0) + c(1) * c(1) + c(2) * c(2)) / (2 * r) - r / 2;
}
void Sphere :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void Sphere :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "sphere";
coeffs.SetSize (4);
@ -377,7 +377,7 @@ namespace netgen
coeffs.Elem(4) = r;
}
void Sphere :: SetPrimitiveData (Array<double> & coeffs)
void Sphere :: SetPrimitiveData (NgArray<double> & coeffs)
{
c(0) = coeffs.Elem(1);
c(1) = coeffs.Elem(2);
@ -731,7 +731,7 @@ namespace netgen
Cylinder :: Cylinder (Array<double> & coeffs)
Cylinder :: Cylinder (NgArray<double> & coeffs)
{
SetPrimitiveData(coeffs);
}
@ -773,7 +773,7 @@ namespace netgen
void Cylinder :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void Cylinder :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "cylinder";
coeffs.SetSize (7);
@ -786,7 +786,7 @@ namespace netgen
coeffs.Elem(7) = r;
}
void Cylinder :: SetPrimitiveData (Array<double> & coeffs)
void Cylinder :: SetPrimitiveData (NgArray<double> & coeffs)
{
a(0) = coeffs.Elem(1);
a(1) = coeffs.Elem(2);
@ -1127,14 +1127,14 @@ namespace netgen
CalcData();
}
EllipticCylinder :: EllipticCylinder (Array<double> & coeffs)
EllipticCylinder :: EllipticCylinder (NgArray<double> & coeffs)
{
SetPrimitiveData(coeffs);
}
void EllipticCylinder :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void EllipticCylinder :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "ellipticcylinder";
coeffs.SetSize (9);
@ -1149,7 +1149,7 @@ namespace netgen
coeffs[8] = vs(2);
}
void EllipticCylinder :: SetPrimitiveData (Array<double> & coeffs)
void EllipticCylinder :: SetPrimitiveData (NgArray<double> & coeffs)
{
a(0) = coeffs[0];
a(1) = coeffs[1];
@ -1312,7 +1312,7 @@ namespace netgen
void Cone :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void Cone :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "cone";
coeffs.SetSize (8);
@ -1326,7 +1326,7 @@ namespace netgen
coeffs.Elem(8) = rb;
}
void Cone :: SetPrimitiveData (Array<double> & coeffs)
void Cone :: SetPrimitiveData (NgArray<double> & coeffs)
{
a(0) = coeffs.Elem(1);
a(1) = coeffs.Elem(2);
@ -1537,7 +1537,7 @@ Primitive * EllipticCone :: CreateDefault ()
}
void EllipticCone :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void EllipticCone :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "ellipticcone";
coeffs.SetSize (15);
@ -1556,7 +1556,7 @@ Primitive * EllipticCone :: CreateDefault ()
}
void EllipticCone :: SetPrimitiveData (Array<double> & coeffs)
void EllipticCone :: SetPrimitiveData (NgArray<double> & coeffs)
{
a(0) = coeffs.Elem(1);
@ -1727,7 +1727,7 @@ void EllipticCone :: GetTriangleApproximation
r = ar;
}
void Torus :: GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
void Torus :: GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "torus";
coeffs.SetSize (8);
@ -1741,7 +1741,7 @@ void EllipticCone :: GetTriangleApproximation
coeffs.Elem(8) = r;
}
void Torus :: SetPrimitiveData (Array<double> & coeffs)
void Torus :: SetPrimitiveData (NgArray<double> & coeffs)
{
c(0) = coeffs.Elem(1);
c(1) = coeffs.Elem(2);

View File

@ -80,8 +80,8 @@ namespace netgen
Point<3> P() const { return p; }
Vec<3> N() const { return n; }
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
@ -153,8 +153,8 @@ namespace netgen
}
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
@ -208,7 +208,7 @@ namespace netgen
public:
Cylinder (const Point<3> & aa, const Point<3> & ab, double ar);
Cylinder (Array<double> & coeffs);
Cylinder (NgArray<double> & coeffs);
// default constructor for archive
Cylinder() {}
@ -220,8 +220,8 @@ namespace netgen
Point<3> A() const { return a; }
Point<3> B() const { return b; }
double R() const { return r; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
@ -278,7 +278,7 @@ namespace netgen
///
EllipticCylinder (const Point<3> & aa,
const Vec<3> & avl, const Vec<3> & avs);
EllipticCylinder (Array<double> & coeffs);
EllipticCylinder (NgArray<double> & coeffs);
// default constructor for archive
EllipticCylinder() {}
@ -289,8 +289,8 @@ namespace netgen
}
// static Primitive * CreateDefault ();
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
@ -393,8 +393,8 @@ namespace netgen
ar & a & b & ra & rb & minr & vab & t0vec & t1vec & vabl & t0 & t1 & cosphi;
}
static Primitive * CreateDefault ();
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
@ -445,8 +445,8 @@ namespace netgen
ar & a & vl & vs & h & vlr;
}
static Primitive * CreateDefault ();
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
@ -513,9 +513,9 @@ namespace netgen
virtual Point<3> GetSurfacePoint () const;
/// OK
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
NgArray<double> & coeffs) const;
/// OK
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void SetPrimitiveData (NgArray<double> & coeffs);
/// OK
static Primitive * CreateDefault ();
/// OK

View File

@ -343,7 +343,7 @@ INSOLID_TYPE Brick :: VecInSolid4 (const Point<3> & p,
void Brick ::
GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const
{
classname = "brick";
coeffs.SetSize(12);
@ -364,7 +364,7 @@ GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
coeffs.Elem(12) = p4(2);
}
void Brick :: SetPrimitiveData (Array<double> & coeffs)
void Brick :: SetPrimitiveData (NgArray<double> & coeffs)
{
p1(0) = coeffs.Elem(1);
p1(1) = coeffs.Elem(2);
@ -414,7 +414,7 @@ void Brick :: CalcData()
{ 1, 5, 3, 7 },
{ 2, 4, 6, 8 } };
Array<double> data(6);
NgArray<double> data(6);
for (i = 0; i < 6; i++)
{
const Point<3> lp1 = pi[lface[i][0]-1];

View File

@ -63,8 +63,8 @@ namespace netgen
{
Point<3> p1, p2, p3, p4;
Vec<3> v12, v13, v14;
// Array<OneSurfacePrimitive*> faces;
Array<Plane*> faces;
// NgArray<OneSurfacePrimitive*> faces;
NgArray<Plane*> faces;
public:
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
@ -115,8 +115,8 @@ namespace netgen
{ return *faces[i]; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();

View File

@ -75,7 +75,7 @@ namespace netgen
void CSGeometry :: Clean ()
{
Array< Solid* > to_delete;
NgArray< Solid* > to_delete;
for (int i = 0; i < solids.Size(); i++)
if(!to_delete.Contains(solids[i]->S1()))
@ -162,7 +162,7 @@ namespace netgen
if (prim)
{
const char * classname;
Array<double> coeffs;
NgArray<double> coeffs;
prim -> GetPrimitiveData (classname, coeffs);
@ -237,7 +237,7 @@ namespace netgen
char key[100], name[100], classname[100], sname[100];
int ncoeff, i, j;
Array<double> coeff;
NgArray<double> coeff;
while (ist.good())
{
@ -343,7 +343,7 @@ namespace netgen
Array<double> coeffs;
NgArray<double> coeffs;
const char * classname;
out << "csgsurfaces " << GetNSurf() << "\n";
@ -408,7 +408,7 @@ namespace netgen
void CSGeometry :: LoadSurfaces (istream & in)
{
Array<double> coeffs;
NgArray<double> coeffs;
string classname;
int nsurfaces,size;
@ -722,7 +722,7 @@ namespace netgen
void CSGeometry :: SetFlags (const char * solidname, const Flags & flags)
{
Solid * solid = solids[solidname];
Array<int> surfind;
NgArray<int> surfind;
int i;
double maxh = flags.GetNumFlag ("maxh", -1);
@ -752,7 +752,7 @@ namespace netgen
if (flags.StringListFlagDefined ("bcname"))
{
const Array<char*> & bcname = flags.GetStringListFlag("bcname");
const NgArray<char*> & bcname = flags.GetStringListFlag("bcname");
Polyhedra * polyh;
if(solid->S1())
@ -762,7 +762,7 @@ namespace netgen
if(polyh)
{
Array < Array<int> * > polysurfs;
NgArray < NgArray<int> * > polysurfs;
polyh->GetPolySurfs(polysurfs);
if(bcname.Size() != polysurfs.Size())
cerr << "WARNING: solid \"" << solidname << "\" has " << polysurfs.Size()
@ -806,7 +806,7 @@ namespace netgen
if (flags.NumListFlagDefined ("bc"))
{
const Array<double> & bcnum = flags.GetNumListFlag("bc");
const NgArray<double> & bcnum = flags.GetNumListFlag("bc");
Polyhedra * polyh;
if(solid->S1())
@ -816,7 +816,7 @@ namespace netgen
if(polyh)
{
Array < Array<int> * > polysurfs;
NgArray < NgArray<int> * > polysurfs;
polyh->GetPolySurfs(polysurfs);
if(bcnum.Size() != polysurfs.Size())
cerr << "WARNING: solid \"" << solidname << "\" has " << polysurfs.Size()
@ -880,7 +880,7 @@ namespace netgen
void CSGeometry ::
GetSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const
NgArray<int> & locsurf) const
{
ReducePrimitiveIterator rpi(box);
UnReducePrimitiveIterator urpi;
@ -909,7 +909,7 @@ namespace netgen
void CSGeometry ::
GetIndependentSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const
NgArray<int> & locsurf) const
{
ReducePrimitiveIterator rpi(box);
UnReducePrimitiveIterator urpi;
@ -968,7 +968,7 @@ namespace netgen
void CSGeometry ::
GetIndependentSurfaceIndices (const Solid * sol,
const Point<3> & p, Vec<3> & v,
Array<int> & locsurf) const
NgArray<int> & locsurf) const
{
cout << "very dangerous" << endl;
Point<3> p2 = p + 1e-2 * v;
@ -980,7 +980,7 @@ namespace netgen
*/
void CSGeometry ::
GetIndependentSurfaceIndices (Array<int> & locsurf) const
GetIndependentSurfaceIndices (NgArray<int> & locsurf) const
{
for (int i = 0; i < locsurf.Size(); i++)
locsurf[i] = isidenticto[locsurf[i]];
@ -1022,7 +1022,7 @@ namespace netgen
delete triapprox[i];
triapprox.SetSize (ntlo);
Array<int> surfind;
NgArray<int> surfind;
IndexSet iset(GetNSurf());
for (int i = 0; i < ntlo; i++)
@ -1148,7 +1148,7 @@ namespace netgen
//return;
int pinds[6];
ArrayMem<int,500> surfused(GetNSurf());
NgArrayMem<int,500> surfused(GetNSurf());
ReducePrimitiveIterator rpi(box);
UnReducePrimitiveIterator urpi;
@ -1159,7 +1159,7 @@ namespace netgen
// IndexSet iset(GetNSurf());
locsol -> GetSurfaceIndices (iset);
const Array<int> & lsurfi = iset.GetArray();
const NgArray<int> & lsurfi = iset.GetArray();
locsol -> IterateSolid (urpi);

View File

@ -106,10 +106,10 @@ namespace netgen
public:
/// primitive of surface
Array<const Primitive*> surf2prim;
NgArray<const Primitive*> surf2prim;
private:
Array<Surface*> delete_them;
NgArray<Surface*> delete_them;
/// all named solids
SymbolTable<Solid*> solids;
@ -120,7 +120,7 @@ namespace netgen
SymbolTable< SplineGeometry<3>* > splinecurves3d;
/// all top level objects: solids and surfaces
Array<TopLevelObject*> toplevelobjects;
NgArray<TopLevelObject*> toplevelobjects;
public:
/// additional points specified by user
@ -139,14 +139,14 @@ namespace netgen
};
private:
// Array<Point<3> > userpoints;
Array<UserPoint> userpoints;
Array<double> userpoints_ref_factor;
// NgArray<Point<3> > userpoints;
NgArray<UserPoint> userpoints;
NgArray<double> userpoints_ref_factor;
mutable Array<Point<3> > identpoints;
mutable NgArray<Point<3> > identpoints;
/// triangular approximation of top level objects
Array<TriangleApproximation*> triapprox;
NgArray<TriangleApproximation*> triapprox;
/// increment, if geometry is changed
static int changeval;
@ -159,7 +159,7 @@ namespace netgen
/// identic surfaces are stored by pair of indizes, val = inverse
INDEX_2_HASHTABLE<int> identicsurfaces;
Array<int> isidenticto;
NgArray<int> isidenticto;
/// identification of boundaries (periodic, thin domains, ...)
double ideps;
@ -168,7 +168,7 @@ namespace netgen
string filename;
/// store splinesurfaces, such that added ones do not get deleted before geometry does
Array<shared_ptr<SplineSurface>> spline_surfaces;
NgArray<shared_ptr<SplineSurface>> spline_surfaces;
shared_ptr<BlockAllocator> solid_ball = Solid::ball;
@ -263,10 +263,10 @@ namespace netgen
// quick implementations:
Array<SingularFace*> singfaces;
Array<SingularEdge*> singedges;
Array<SingularPoint*> singpoints;
Array<Identification*> identifications;
NgArray<SingularFace*> singfaces;
NgArray<SingularEdge*> singedges;
NgArray<SingularPoint*> singpoints;
NgArray<Identification*> identifications;
int GetNIdentifications (void) const { return identifications.Size(); }
void AddIdentification (Identification * ident);
@ -280,19 +280,19 @@ namespace netgen
///
void GetSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const;
NgArray<int> & locsurf) const;
///
void GetIndependentSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const;
NgArray<int> & locsurf) const;
///
/*
void GetIndependentSurfaceIndices (const Solid * sol,
const Point<3> & p, Vec<3> & v,
Array<int> & locsurf) const;
NgArray<int> & locsurf) const;
*/
///
void GetIndependentSurfaceIndices (Array<int> & locsurf) const;
void GetIndependentSurfaceIndices (NgArray<int> & locsurf) const;
///
int GetSurfaceClassRepresentant (int si) const
@ -344,7 +344,7 @@ namespace netgen
string * bcname;
};
Array<BCModification> bcmodifications;
NgArray<BCModification> bcmodifications;
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam) override;

View File

@ -399,7 +399,7 @@ namespace netgen
int inputface = 0;
while (1)
{
Array<int> pnums,cleaned_pnums;
NgArray<int> pnums,cleaned_pnums;
for(int i=0; i<3; i++)
{
pnums.Append((int) (ParseNumber (scan)));
@ -786,7 +786,7 @@ namespace netgen
if(scan.GetToken() == '-' || scan.GetToken() == TOK_NUM)
{
Array<double> vals;
NgArray<double> vals;
vals.Append (ParseNumber(scan));
while (scan.GetToken() == ',')
{
@ -798,7 +798,7 @@ namespace netgen
}
else
{ // string list
Array<char*> vals;
NgArray<char*> vals;
string val = scan.GetStringValue();
vals.Append(new char[val.size()+1]);
strcpy(vals.Last(),val.c_str());
@ -908,7 +908,7 @@ namespace netgen
if (flags.NumListFlagDefined ("col"))
{
const Array<double> & col =
const NgArray<double> & col =
flags.GetNumListFlag ("col");
tlo->SetRGB (col[0], col[1], col[2]);
}
@ -934,7 +934,7 @@ namespace netgen
ParseChar (scan, ';');
Array<int> si;
NgArray<int> si;
geom->GetSolid(surfname)->GetSurfaceIndices(si);
int tlonr =
geom->SetTopLevelObject ((Solid*)geom->GetSolid(name),
@ -942,7 +942,7 @@ namespace netgen
TopLevelObject * tlo = geom->GetTopLevelObject (tlonr);
if (flags.NumListFlagDefined ("col"))
{
const Array<double> & col = flags.GetNumListFlag ("col");
const NgArray<double> & col = flags.GetNumListFlag ("col");
tlo->SetRGB (col.Get(1), col.Get(2), col.Get(3));
}
if (flags.GetDefineFlag ("transparent"))
@ -980,7 +980,7 @@ namespace netgen
ParseChar (scan, ';');
Array<int> si1, si2;
NgArray<int> si1, si2;
geom->GetSolid(name1)->GetSurfaceIndices(si1);
geom->GetSolid(name2)->GetSurfaceIndices(si2);
@ -1016,7 +1016,7 @@ namespace netgen
ParseChar (scan, ';');
Array<int> si1, si2;
NgArray<int> si1, si2;
geom->GetSolid(name1)->GetSurfaceIndices(si1);
geom->GetSolid(name2)->GetSurfaceIndices(si2);
@ -1246,7 +1246,7 @@ namespace netgen
CSGeometry::BCModification bcm;
bcm.bcname = NULL;
Array<int> si;
NgArray<int> si;
geom->GetSolid(name1)->GetSurfaceIndices(si);
if(si.Size() == 0)
@ -1298,7 +1298,7 @@ namespace netgen
bcm.bcname = NULL;
Array<int> si;
NgArray<int> si;
geom->GetSolid(name1)->GetSurfaceIndices(si);
if(si.Size() == 0)

View File

@ -154,7 +154,7 @@ namespace netgen
tcl_const char * name = argv[1];
tcl_const char * value = argv[2];
Array<double> coeffs;
NgArray<double> coeffs;
cout << "Set primitive data, name = " << name
@ -222,7 +222,7 @@ namespace netgen
const char * classname;
Array<double> coeffs;
NgArray<double> coeffs;
geometry->GetSolid (name)->GetPrimitive()->GetPrimitiveData (classname, coeffs);

View File

@ -10,7 +10,7 @@ namespace netgen
EdgeCalculation ::
EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints,
NgArray<SpecialPoint> & aspecpoints,
MeshingParameters & amparam)
: geometry(ageometry), specpoints(aspecpoints), mparam(amparam)
{
@ -48,7 +48,7 @@ namespace netgen
// add all special points before edge points (important for periodic identification)
// JS, Jan 2007
const double di=1e-7*geometry.MaxSize();
Array<int> locsearch;
NgArray<int> locsearch;
for (int i = 0; i < specpoints.Size(); i++)
if (specpoints[i].unconditional)
@ -96,9 +96,9 @@ namespace netgen
void EdgeCalculation :: CalcEdges1 (double h, Mesh & mesh)
{
Array<int> hsp(specpoints.Size());
Array<int> glob2hsp(specpoints.Size());
Array<int> startpoints, endpoints;
NgArray<int> hsp(specpoints.Size());
NgArray<int> glob2hsp(specpoints.Size());
NgArray<int> startpoints, endpoints;
int pos, ep;
@ -107,11 +107,11 @@ namespace netgen
Point<3> p, np;
int pi1, s1, s2, s1_orig, s2_orig;
Array<Point<3> > edgepoints;
Array<double> curvelength;
NgArray<Point<3> > edgepoints;
NgArray<double> curvelength;
int copyedge = 0, copyfromedge = -1, copyedgeidentification = -1;
Array<int> locsurfind, locind;
NgArray<int> locsurfind, locind;
int checkedcopy = 0;
@ -406,8 +406,8 @@ namespace netgen
}
Array<Segment> refedges;
Array<bool> refedgesinv;
NgArray<Segment> refedges;
NgArray<bool> refedgesinv;
AnalyzeEdge (s1_orig, s2_orig, s1, s2, pos, layer,
@ -546,7 +546,7 @@ namespace netgen
SegmentIndex si;
PointIndex pi;
Array<int> osedges(cntedge);
NgArray<int> osedges(cntedge);
INDEX_2_HASHTABLE<int> osedgesht (cntedge+1);
osedges = 2;
@ -678,17 +678,17 @@ namespace netgen
void EdgeCalculation ::
FollowEdge (int pi1, int & ep, int & pos,
const Array<int> & hsp,
const NgArray<int> & hsp,
double h, const Mesh & mesh,
Array<Point<3> > & edgepoints,
Array<double> & curvelength)
NgArray<Point<3> > & edgepoints,
NgArray<double> & curvelength)
{
int s1, s2, s1_rep, s2_rep;
double len, steplen, cursteplen, loch;
Point<3> p, np, pnp;
Vec<3> a1, a2, t;
Array<int> locind;
NgArray<int> locind;
double size = geometry.MaxSize();
double epspointdist2 = size * 1e-6;
@ -904,14 +904,14 @@ namespace netgen
void EdgeCalculation ::
AnalyzeEdge (int s1, int s2, int s1_rep, int s2_rep, int pos, int layer,
const Array<Point<3> > & edgepoints,
Array<Segment> & refedges,
Array<bool> & refedgesinv)
const NgArray<Point<3> > & edgepoints,
NgArray<Segment> & refedges,
NgArray<bool> & refedgesinv)
{
Segment seg;
Array<int> locsurfind, locsurfind2;
NgArray<int> locsurfind, locsurfind2;
Array<int> edges_priority;
NgArray<int> edges_priority;
double size = geometry.MaxSize();
bool debug = 0;
@ -1062,7 +1062,7 @@ namespace netgen
//int k;
double eps = 1e-8*size;
Array<bool> pre_ok(2);
NgArray<bool> pre_ok(2);
do
{
@ -1291,10 +1291,10 @@ namespace netgen
void EdgeCalculation ::
StoreEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
StoreEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
const NgArray<Point<3> > & edgepoints,
const NgArray<double> & curvelength,
int layer,
Mesh & mesh)
{
@ -1340,7 +1340,7 @@ namespace netgen
const double di=1e-7*geometry.MaxSize();
Array<int> locsearch;
NgArray<int> locsearch;
meshpoint_tree -> GetIntersecting (p-Vec<3> (di,di,di),
p+Vec<3> (di,di,di), locsearch);
if (locsearch.Size())
@ -1463,10 +1463,10 @@ namespace netgen
void EdgeCalculation ::
StoreShortEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
StoreShortEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
const NgArray<Point<3> > & edgepoints,
const NgArray<double> & curvelength,
int layer,
Mesh & mesh)
{
@ -1594,8 +1594,8 @@ namespace netgen
void EdgeCalculation ::
CopyEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
CopyEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
int copyfromedge,
const Point<3> & fromstart, const Point<3> & fromend,
const Point<3> & tostart, const Point<3> & toend,
@ -1742,7 +1742,7 @@ namespace netgen
int layer = 0;
Solid * tansol;
Array<int> tansurfind;
NgArray<int> tansurfind;
double size = geometry.MaxSize();
int nsol = geometry.GetNTopLevelObjects();

View File

@ -26,7 +26,7 @@ namespace netgen
points have to be given.
*/
extern void CalcEdges (const CSGeometry & geometry,
const Array<SpecialPoint> & specpoints,
const NgArray<SpecialPoint> & specpoints,
double h, Mesh & mesh);
@ -36,7 +36,7 @@ namespace netgen
class EdgeCalculation
{
const CSGeometry & geometry;
Array<SpecialPoint> & specpoints;
NgArray<SpecialPoint> & specpoints;
Point3dTree * searchtree;
Point3dTree * meshpoint_tree;
int cntedge;
@ -46,7 +46,7 @@ namespace netgen
public:
EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints,
NgArray<SpecialPoint> & aspecpoints,
MeshingParameters & amparam);
~EdgeCalculation();
@ -61,34 +61,34 @@ namespace netgen
void FollowEdge (int pi1, int & ep, int & pos,
// const Array<SpecialPoint> & hsp,
const Array<int> & hsp,
// const NgArray<SpecialPoint> & hsp,
const NgArray<int> & hsp,
double h, const Mesh & mesh,
Array<Point<3> > & edgepoints,
Array<double> & curvelength);
NgArray<Point<3> > & edgepoints,
NgArray<double> & curvelength);
void AnalyzeEdge (int s1, int s2, int s1_rep, int s2_rep, int pos, int layer,
const Array<Point<3> > & edgepoints,
Array<Segment> & refedges,
Array<bool> & refedgesinv);
const NgArray<Point<3> > & edgepoints,
NgArray<Segment> & refedges,
NgArray<bool> & refedgesinv);
void StoreEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
void StoreEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
const NgArray<Point<3> > & edgepoints,
const NgArray<double> & curvelength,
int layer,
Mesh & mesh);
void StoreShortEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
void StoreShortEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
const NgArray<Point<3> > & edgepoints,
const NgArray<double> & curvelength,
int layer,
Mesh & mesh);
void CopyEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
void CopyEdge (const NgArray<Segment> & refedges,
const NgArray<bool> & refedgesinv,
int copyfromedge,
const Point<3> & fromstart, const Point<3> & fromend,
const Point<3> & tostart, const Point<3> & toend,

View File

@ -70,9 +70,9 @@ namespace netgen
class BSplineCurve2d : public ExplicitCurve2d
{
///
Array<Point<2> > points;
NgArray<Point<2> > points;
///
Array<int> intervallused;
NgArray<int> intervallused;
///
int redlevel;

View File

@ -7,7 +7,7 @@
namespace netgen
{
Array<Point<3> > project1, project2;
NgArray<Point<3> > project1, project2;
@ -57,13 +57,13 @@ namespace netgen
Init();
}
ExtrusionFace :: ExtrusionFace(const Array<double> & raw_data)
ExtrusionFace :: ExtrusionFace(const NgArray<double> & raw_data)
{
deletable = true;
int pos=0;
Array< Point<2> > p(3);
NgArray< Point<2> > p(3);
int ptype = int(raw_data[pos]); pos++;
@ -142,7 +142,7 @@ namespace netgen
double cutdist = -1;
Array<double> mindist(path->GetNSplines());
NgArray<double> mindist(path->GetNSplines());
for(int i = 0; i < path->GetNSplines(); i++)
{
@ -453,7 +453,7 @@ namespace netgen
v2d(1) = v * loc_z_dir[seg];
Vec<2> n(v2d(1),-v2d(0));
Array < Point<2> > ips;
NgArray < Point<2> > ips;
profile->LineIntersections(v2d(1),
@ -593,7 +593,7 @@ namespace netgen
}
void ExtrusionFace :: GetRawData(Array<double> & data) const
void ExtrusionFace :: GetRawData(NgArray<double> & data) const
{
data.DeleteAll();
profile->GetRawData(data);
@ -695,7 +695,7 @@ namespace netgen
INSOLID_TYPE Extrusion :: PointInSolid (const Point<3> & p,
const double eps,
Array<int> * const facenums) const
NgArray<int> * const facenums) const
{
Vec<3> random_vec(-0.4561,0.7382,0.4970247);
@ -741,7 +741,7 @@ namespace netgen
const Vec<3> & v,
double eps) const
{
Array<int> facenums;
NgArray<int> facenums;
INSOLID_TYPE pInSolid = PointInSolid(p,eps,&facenums);
if(pInSolid != DOES_INTERSECT)

View File

@ -15,11 +15,11 @@ namespace netgen
bool deletable;
Array< const SplineSeg3<3> * > spline3_path;
Array< const LineSeg<3> * > line_path;
NgArray< const SplineSeg3<3> * > spline3_path;
NgArray< const LineSeg<3> * > line_path;
mutable Array < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
mutable Array < Point<3> > p0;
mutable NgArray < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
mutable NgArray < Point<3> > p0;
mutable Vec<3> profile_tangent;
mutable double profile_par;
@ -48,7 +48,7 @@ namespace netgen
const SplineGeometry<3> * path_in,
const Vec<3> & z_direction);
ExtrusionFace(const Array<double> & raw_data);
ExtrusionFace(const NgArray<double> & raw_data);
// default constructor for archive
ExtrusionFace() {}
@ -102,7 +102,7 @@ namespace netgen
const Vec<3> & GetProfileTangent (void) const {return profile_tangent;}
double GetProfilePar(void) const {return profile_par;}
void GetRawData(Array<double> & data) const;
void GetRawData(NgArray<double> & data) const;
void CalcLocalCoordinates (int seg, double t,
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const;
@ -123,7 +123,7 @@ namespace netgen
Vec<3> z_direction;
Array<ExtrusionFace*> faces;
NgArray<ExtrusionFace*> faces;
mutable int latestfacenum;
@ -145,7 +145,7 @@ namespace netgen
double eps) const;
INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps,
Array<int> * const facenums) const;
NgArray<int> * const facenums) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;

View File

@ -10,8 +10,8 @@
namespace netgen
{
Array<SpecialPoint> specpoints;
static Array<MeshPoint> spoints;
NgArray<SpecialPoint> specpoints;
static NgArray<MeshPoint> spoints;
#define TCL_OK 0
#define TCL_ERROR 1
@ -140,7 +140,7 @@ namespace netgen
}
}
Array<int> loc;
NgArray<int> loc;
if (!ec.point_on_edge_problem)
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
@ -234,17 +234,17 @@ namespace netgen
const char * savetask = multithread.task;
multithread.task = "Surface meshing";
Array<Segment> segments;
NgArray<Segment> segments;
int noldp = mesh.GetNP();
double starttime = GetTime();
// find master faces from identified
Array<int> masterface(mesh.GetNFD());
NgArray<int> masterface(mesh.GetNFD());
for (int i = 1; i <= mesh.GetNFD(); i++)
masterface.Elem(i) = i;
Array<INDEX_2> fpairs;
NgArray<INDEX_2> fpairs;
bool changed;
do
{
@ -382,7 +382,7 @@ namespace netgen
for (int j = 0; j < geom.singfaces.Size(); j++)
{
Array<int> surfs;
NgArray<int> surfs;
geom.GetIndependentSurfaceIndices (geom.singfaces[j]->GetSolid(),
geom.BoundingBox(), surfs);
for (int k = 1; k <= mesh.GetNFD(); k++)
@ -680,7 +680,7 @@ namespace netgen
mesh->SetGlobalH (mparam.maxh);
mesh->SetMinimalH (mparam.minh);
Array<double> maxhdom(geom.GetNTopLevelObjects());
NgArray<double> maxhdom(geom.GetNTopLevelObjects());
for (int i = 0; i < maxhdom.Size(); i++)
maxhdom[i] = geom.GetTopLevelObject(i)->GetMaxH();

View File

@ -28,7 +28,7 @@ ostream & operator<< (ostream & ost, Identification & ident)
/*
void Identification :: IdentifySpecialPoints (Array<class SpecialPoint> & points)
void Identification :: IdentifySpecialPoints (NgArray<class SpecialPoint> & points)
{
;
}
@ -84,7 +84,7 @@ void Identification :: IdentifyFaces (class Mesh & mesh)
}
void Identification ::
BuildSurfaceElements (Array<Segment> & segs,
BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf)
{
cout << "Identification::BuildSurfaceElements called for base-class" << endl;
@ -93,14 +93,14 @@ BuildSurfaceElements (Array<Segment> & segs,
void Identification ::
BuildVolumeElements (Array<class Element2d> & surfels,
BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh)
{
;
}
void Identification ::
GetIdentifiedFaces (Array<INDEX_2> & idfaces) const
GetIdentifiedFaces (NgArray<INDEX_2> & idfaces) const
{
idfaces.SetSize(0);
for (int i = 1; i <= identfaces.GetNBags(); i++)
@ -136,7 +136,7 @@ PeriodicIdentification :: ~PeriodicIdentification ()
/*
void PeriodicIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points)
(NgArray<class SpecialPoint> & points)
{
int i, j;
int bestj;
@ -446,7 +446,7 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
void PeriodicIdentification ::
BuildSurfaceElements (Array<Segment> & segs,
BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf)
{
int found = 0;
@ -458,7 +458,7 @@ BuildSurfaceElements (Array<Segment> & segs,
if (geom.GetSurface(surfnr) == s1 ||
geom.GetSurface(surfnr) == s2)
{
Array<int> copy_points;
NgArray<int> copy_points;
for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++)
{
@ -609,7 +609,7 @@ void CloseSurfaceIdentification :: GetData (ostream & ost) const
/*
void CloseSurfaceIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points)
(NgArray<class SpecialPoint> & points)
{
int i, j;
int bestj;
@ -677,7 +677,7 @@ Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
if (!dom_surf_valid)
{
const_cast<bool&> (dom_surf_valid) = 1;
Array<int> & hsurf = const_cast<Array<int>&> (domain_surfaces);
NgArray<int> & hsurf = const_cast<NgArray<int>&> (domain_surfaces);
if (domain)
{
@ -887,7 +887,7 @@ GetIdentifiedPoint (class Mesh & mesh, int pi)
const Surface *snew;
const Point<3> & p = mesh.Point (pi);
Array<int,PointIndex::BASE> identmap(mesh.GetNP());
NgArray<int,PointIndex::BASE> identmap(mesh.GetNP());
mesh.GetIdentifications().GetMap (nr, identmap);
if (identmap.Get(pi))
return identmap.Get(pi);
@ -958,13 +958,13 @@ void CloseSurfaceIdentification :: IdentifyPoints (Mesh & mesh)
{
int np = mesh.GetNP();
Array<int> points_on_surf2;
NgArray<int> points_on_surf2;
for (int i2 = 1; i2 <= np; i2++)
if (s2->PointOnSurface (mesh.Point(i2)))
points_on_surf2.Append (i2);
Array<int> surfs_of_p1;
NgArray<int> surfs_of_p1;
for (int i1 = 1; i1 <= np; i1++)
{
@ -1080,7 +1080,7 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
s2rep = geom.GetSurfaceClassRepresentant(i);
}
Array<int> segs_on_face1, segs_on_face2;
NgArray<int> segs_on_face1, segs_on_face2;
identfaces.DeleteData();
@ -1219,13 +1219,13 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
void CloseSurfaceIdentification ::
BuildSurfaceElements (Array<Segment> & segs,
BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf)
{
bool found = 0;
int cntquads = 0;
Array<int,PointIndex::BASE> identmap;
NgArray<int,PointIndex::BASE> identmap;
identmap = 0;
mesh.GetIdentifications().GetMap (nr, identmap);
@ -1240,7 +1240,7 @@ BuildSurfaceElements (Array<Segment> & segs,
//(*testout) << "segs = " << endl << segs << endl;
//(*testout) << "identmap = " << endl << identmap << endl;
//Array<bool> foundseg(segs.Size());
//NgArray<bool> foundseg(segs.Size());
//foundseg = false;
// insert quad layer:
@ -1301,7 +1301,7 @@ BuildSurfaceElements (Array<Segment> & segs,
{
PrintMessage(3, "insert quad layer of ", cntquads,
" elements at face ", segs.Get(1).si);
//Array<Segment> aux;
//NgArray<Segment> aux;
//for(int i=0; i<segs.Size();i++)
// if(!foundseg[i])
// aux.Append(segs[i]);
@ -1319,7 +1319,7 @@ BuildSurfaceElements (Array<Segment> & segs,
void CloseSurfaceIdentification ::
BuildSurfaceElements2 (Array<Segment> & segs,
BuildSurfaceElements2 (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf)
{
// copy mesh
@ -1420,7 +1420,7 @@ BuildSurfaceElements2 (Array<Segment> & segs,
void CloseSurfaceIdentification ::
BuildVolumeElements (Array<class Element2d> & surfels,
BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh)
{
;
@ -1481,7 +1481,7 @@ void CloseEdgesIdentification :: GetData (ostream & ost) const
/*
void CloseEdgesIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points)
(NgArray<class SpecialPoint> & points)
{
int i, j;
int bestj;
@ -1633,7 +1633,7 @@ void CloseEdgesIdentification :: IdentifyPoints (Mesh & mesh)
}
void CloseEdgesIdentification ::
BuildSurfaceElements (Array<Segment> & segs,
BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf)
{
int found = 0;

View File

@ -34,7 +34,7 @@ namespace netgen
DLL_HEADER virtual void GetData (ostream & ost) const = 0;
/// obsolete
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
// virtual void IdentifySpecialPoints (NgArray<class SpecialPoint> & points);
/// can identify both special points (fixed direction)
/// (identified points, same tangent)
@ -59,16 +59,16 @@ namespace netgen
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
/// copy surfaces, or fill rectangles
virtual void BuildSurfaceElements (Array<class Segment> & segs,
virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
/// insert volume elements in thin layers
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
virtual void BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh);
/// get list of identified faces
virtual void GetIdentifiedFaces (Array<INDEX_2> & idfaces) const;
virtual void GetIdentifiedFaces (NgArray<INDEX_2> & idfaces) const;
friend ostream & operator<< (ostream & ost, Identification & ident);
};
@ -91,7 +91,7 @@ namespace netgen
virtual void GetData (ostream & ost) const override;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
// virtual void IdentifySpecialPoints (NgArray<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const override;
@ -100,7 +100,7 @@ namespace netgen
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1) override;
virtual void IdentifyPoints (class Mesh & mesh) override;
virtual void IdentifyFaces (class Mesh & mesh) override;
virtual void BuildSurfaceElements (Array<class Segment> & segs,
virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
class Mesh & mesh,
const Surface * surf) override;
};
@ -123,9 +123,9 @@ namespace netgen
int ref_levels_s2;
///
double eps_n;
Array<double> slices;
NgArray<double> slices;
/// used only for domain-local identification:
Array<int> domain_surfaces;
NgArray<int> domain_surfaces;
///
bool dom_surf_valid;
@ -146,7 +146,7 @@ namespace netgen
virtual void GetData (ostream & ost) const;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
// virtual void IdentifySpecialPoints (NgArray<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
@ -154,17 +154,17 @@ namespace netgen
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
const Array<double> & GetSlices () const { return slices; }
const NgArray<double> & GetSlices () const { return slices; }
virtual void IdentifyPoints (class Mesh & mesh);
virtual void IdentifyFaces (class Mesh & mesh);
virtual void BuildSurfaceElements (Array<class Segment> & segs,
virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
void BuildSurfaceElements2 (Array<class Segment> & segs,
void BuildSurfaceElements2 (NgArray<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
virtual void BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh);
int RefLevels () const { return ref_levels; }
@ -196,14 +196,14 @@ namespace netgen
virtual void Print (ostream & ost) const;
virtual void GetData (ostream & ost) const;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
// virtual void IdentifySpecialPoints (NgArray<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
virtual void IdentifyPoints (class Mesh & mesh);
virtual void BuildSurfaceElements (Array<class Segment> & segs,
virtual void BuildSurfaceElements (NgArray<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
};

View File

@ -7,7 +7,7 @@ namespace netgen
{
Polyhedra::Face::Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points,
const NgArray<Point<3> > & points,
int ainputnr)
{
inputnr = ainputnr;
@ -165,7 +165,7 @@ INSOLID_TYPE Polyhedra :: PointInSolid (const Point<3> & p,
void Polyhedra :: GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
for (int i = 0; i < faces.Size(); i++)
{
@ -192,7 +192,7 @@ INSOLID_TYPE Polyhedra :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
Array<int> point_on_faces;
NgArray<int> point_on_faces;
INSOLID_TYPE res(DOES_INTERSECT);
Vec<3> vn = v;
@ -388,7 +388,7 @@ INSOLID_TYPE Polyhedra :: VecInSolid2 (const Point<3> & p,
void Polyhedra :: GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
Vec<3> v1n = v1;
v1n.Normalize();
@ -447,7 +447,7 @@ void Polyhedra :: GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec
void Polyhedra :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const
NgArray<double> & coeffs) const
{
classname = "Polyhedra";
coeffs.SetSize(0);
@ -471,7 +471,7 @@ void Polyhedra :: GetPrimitiveData (const char *& classname,
*/
}
void Polyhedra :: SetPrimitiveData (Array<double> & /* coeffs */)
void Polyhedra :: SetPrimitiveData (NgArray<double> & /* coeffs */)
{
;
}
@ -590,7 +590,7 @@ int Polyhedra :: FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const
}
void Polyhedra :: GetPolySurfs(Array < Array<int> * > & polysurfs)
void Polyhedra :: GetPolySurfs(NgArray < NgArray<int> * > & polysurfs)
{
int maxnum = -1;
@ -602,14 +602,14 @@ void Polyhedra :: GetPolySurfs(Array < Array<int> * > & polysurfs)
polysurfs.SetSize(maxnum+1);
for(int i=0; i<polysurfs.Size(); i++)
polysurfs[i] = new Array<int>;
polysurfs[i] = new NgArray<int>;
for(int i = 0; i<faces.Size(); i++)
polysurfs[faces[i].inputnr]->Append(faces[i].planenr);
}
void Polyhedra::CalcSpecialPoints (Array<Point<3> > & pts) const
void Polyhedra::CalcSpecialPoints (NgArray<Point<3> > & pts) const
{
for (int i = 0; i < points.Size(); i++)
pts.Append (points[i]);
@ -617,7 +617,7 @@ void Polyhedra::CalcSpecialPoints (Array<Point<3> > & pts) const
void Polyhedra :: AnalyzeSpecialPoint (const Point<3> & /* pt */,
Array<Point<3> > & /* specpts */) const
NgArray<Point<3> > & /* specpts */) const
{
;
}

View File

@ -35,13 +35,13 @@ namespace netgen
Face () { ; }
Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points,
const NgArray<Point<3> > & points,
int ainputnr);
};
Array<Point<3> > points;
Array<Face> faces;
Array<Plane*> planes;
NgArray<Point<3> > points;
NgArray<Face> faces;
NgArray<Plane*> planes;
Box<3> poly_bbox;
double eps_base1;
@ -65,15 +65,15 @@ namespace netgen
double eps) const;
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual void CalcSpecialPoints (Array<Point<3> > & pts) const;
virtual void CalcSpecialPoints (NgArray<Point<3> > & pts) const;
virtual void AnalyzeSpecialPoint (const Point<3> & pt,
Array<Point<3> > & specpts) const;
NgArray<Point<3> > & specpts) const;
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const;
virtual int GetNSurfaces() const
@ -83,8 +83,8 @@ namespace netgen
virtual const Surface & GetSurface (int i) const
{ return *planes[i]; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
@ -92,7 +92,7 @@ namespace netgen
int AddPoint (const Point<3> & p);
int AddFace (int pi1, int pi2, int pi3, int inputnum);
void GetPolySurfs(Array < Array<int> * > & polysurfs);
void GetPolySurfs(NgArray < NgArray<int> * > & polysurfs);
protected:
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;

View File

@ -211,7 +211,7 @@ DLL_HEADER void ExportCSG(py::module &m)
.def("__init__", FunctionPointer ([](SplineSurface* instance, shared_ptr<SPSolid> base, py::list cuts)
{
auto primitive = dynamic_cast<OneSurfacePrimitive*> (base->GetSolid()->GetPrimitive());
auto acuts = make_shared<Array<shared_ptr<OneSurfacePrimitive>>>();
auto acuts = make_shared<NgArray<shared_ptr<OneSurfacePrimitive>>>();
for(int i = 0; i<py::len(cuts);i++)
{
py::extract<shared_ptr<SPSolid>> sps(cuts[i]);
@ -409,7 +409,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
if (py::extract<int>(val).check()) mod_nr = py::extract<int> (val)();
if (py::extract<string>(val).check()) bcname = new string ( py::extract<string> (val)());
Array<int> si;
NgArray<int> si;
mod_solid -> GetSolid() -> GetSurfaceIndices (si);
// cout << "change bc on surfaces: " << si << " to " << mod_nr << endl;
@ -459,7 +459,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
self.GetTopLevelObject(tlonr) -> SetBCProp(surf->GetBase()->GetBCProperty());
self.GetTopLevelObject(tlonr) -> SetBCName(surf->GetBase()->GetBCName());
self.GetTopLevelObject(tlonr) -> SetMaxH(surf->GetBase()->GetMaxH());
Array<Point<3>> non_midpoints;
NgArray<Point<3>> non_midpoints;
for(auto spline : surf->GetSplines())
{
non_midpoints.Append(spline->GetPoint(0));
@ -494,7 +494,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
.def("CloseSurfaces", FunctionPointer
([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2, py::list aslices )
{
Array<int> si1, si2;
NgArray<int> si1, si2;
s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2);
cout << "surface ids1 = " << si1 << endl;
@ -505,7 +505,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
try
{
int n = py::len(aslices);
Array<double> slices(n);
NgArray<double> slices(n);
for(int i=0; i<n; i++)
{
slices[i]= py::extract<double>(aslices[i])();
@ -531,7 +531,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2,
int reflevels, shared_ptr<SPSolid> domain_solid)
{
Array<int> si1, si2;
NgArray<int> si1, si2;
s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2);
cout << "surface ids1 = " << si1 << endl;
@ -556,7 +556,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2,
Transformation<3> trafo)
{
Array<int> si1, si2;
NgArray<int> si1, si2;
s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2);
cout << "identify surfaces " << si1[0] << " and " << si2[0] << endl;

View File

@ -52,13 +52,13 @@ namespace netgen
}
RevolutionFace :: RevolutionFace(const Array<double> & raw_data)
RevolutionFace :: RevolutionFace(const NgArray<double> & raw_data)
{
deletable = true;
int pos = 0;
Array< Point<2> > p(3);
NgArray< Point<2> > p(3);
int stype = int(raw_data[pos]); pos++;
@ -333,7 +333,7 @@ namespace netgen
{
double retval = spline->MaxCurvature();
Array < Point<2> > checkpoints;
NgArray < Point<2> > checkpoints;
const SplineSeg3<2> * ss3 = dynamic_cast<const SplineSeg3<2> *>(spline);
const LineSeg<2> * ls = dynamic_cast<const LineSeg<2> *>(spline);
@ -386,7 +386,7 @@ namespace netgen
// find smallest y value of spline:
Array<double> testt;
NgArray<double> testt;
if(!isfirst)
testt.Append(0);
@ -624,7 +624,7 @@ namespace netgen
void RevolutionFace :: GetRawData(Array<double> & data) const
void RevolutionFace :: GetRawData(NgArray<double> & data) const
{
data.DeleteAll();
spline->GetRawData(data);
@ -718,7 +718,7 @@ namespace netgen
return DOES_INTERSECT;
else
{
Array < Point<3> > pext(2);
NgArray < Point<3> > pext(2);
Point<3> p;
pext[0] = box.PMin();
@ -772,7 +772,7 @@ namespace netgen
const double b = -randomx;
const double c = -a*p2d(0)-b*p2d(1);
Array < Point<2> > points;
NgArray < Point<2> > points;
//(*testout) << "face intersections at: " << endl;
for(int i=0; i<faces.Size(); i++)
@ -803,7 +803,7 @@ namespace netgen
}
void Revolution :: GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
for (int j = 0; j < faces.Size(); j++)
if (faces[j] -> PointInFace(p, eps))
@ -823,7 +823,7 @@ namespace netgen
return pInSolid;
}
Array<int> intersecting_faces;
NgArray<int> intersecting_faces;
for(int i=0; i<faces.Size(); i++)
if(faces[i]->PointInFace(p,eps)) // == DOES_INTERSECT)

View File

@ -23,9 +23,9 @@ namespace netgen
mutable Vector spline_coefficient_shifted;
Array < Vec<2>* > checklines_vec;
Array < Point<2>* > checklines_start;
Array < Vec<2>* > checklines_normal;
NgArray < Vec<2>* > checklines_vec;
NgArray < Point<2>* > checklines_start;
NgArray < Vec<2>* > checklines_normal;
private:
void Init (void);
@ -44,7 +44,7 @@ namespace netgen
bool last = false,
const int id_in = 0);
RevolutionFace(const Array<double> & raw_data);
RevolutionFace(const NgArray<double> & raw_data);
// default constructor for archive
RevolutionFace() {}
@ -87,7 +87,7 @@ namespace netgen
/* INSOLID_TYPE */ bool PointInFace (const Point<3> & p, const double eps) const;
void GetRawData(Array<double> & data) const;
void GetRawData(NgArray<double> & data) const;
};
@ -111,7 +111,7 @@ namespace netgen
int type;
Array<RevolutionFace*> faces;
NgArray<RevolutionFace*> faces;
mutable int intersecting_face;
@ -143,7 +143,7 @@ namespace netgen
double eps) const;
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,

View File

@ -41,7 +41,7 @@ void SingularEdge :: FindPointsOnEdge (class Mesh & mesh)
segms.SetSize(0);
Array<int> si1, si2;
NgArray<int> si1, si2;
sol1->GetSurfaceIndices (si1);
sol2->GetSurfaceIndices (si2);
@ -150,7 +150,7 @@ SingularPoint :: SingularPoint (double abeta,
void SingularPoint :: FindPoints (class Mesh & mesh)
{
points.SetSize(0);
Array<int> surfk, surf;
NgArray<int> surfk, surf;
for (PointIndex pi = PointIndex::BASE;

View File

@ -29,8 +29,8 @@ namespace netgen
int domnr;
const Solid *sol;
double factor;
// Array<Point<3> > points;
// Array<INDEX_2> segms;
// NgArray<Point<3> > points;
// NgArray<INDEX_2> segms;
public:
SingularFace (int adomnr, const Solid * asol, double sf)
: domnr(adomnr), sol(asol), factor(sf) { ; }
@ -47,8 +47,8 @@ namespace netgen
int domnr;
const CSGeometry& geom;
const Solid *sol1, *sol2;
Array<Point<3> > points;
Array<INDEX_2> segms;
NgArray<Point<3> > points;
NgArray<INDEX_2> segms;
double factor;
double maxhinit;
@ -68,7 +68,7 @@ namespace netgen
public:
double beta;
const Solid *sol1, *sol2, *sol3;
Array<Point<3> > points;
NgArray<Point<3> > points;
double factor;
public:

View File

@ -557,14 +557,14 @@ namespace netgen
void Solid :: Boundaries (const Point<3> & p, Array<int> & bounds) const
void Solid :: Boundaries (const Point<3> & p, NgArray<int> & bounds) const
{
int in, strin;
bounds.SetSize (0);
RecBoundaries (p, bounds, in, strin);
}
void Solid :: RecBoundaries (const Point<3> & p, Array<int> & bounds,
void Solid :: RecBoundaries (const Point<3> & p, NgArray<int> & bounds,
int & in, int & strin) const
{
switch (op)
@ -585,7 +585,7 @@ namespace netgen
case SECTION:
{
int i, in1, in2, strin1, strin2;
Array<int> bounds1, bounds2;
NgArray<int> bounds1, bounds2;
s1 -> RecBoundaries (p, bounds1, in1, strin1);
s2 -> RecBoundaries (p, bounds2, in2, strin2);
@ -604,7 +604,7 @@ namespace netgen
case UNION:
{
int i, in1, in2, strin1, strin2;
Array<int> bounds1, bounds2;
NgArray<int> bounds1, bounds2;
s1 -> RecBoundaries (p, bounds1, in1, strin1);
s2 -> RecBoundaries (p, bounds2, in2, strin2);
@ -638,7 +638,7 @@ namespace netgen
}
void Solid :: TangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids, double eps) const
void Solid :: TangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids, double eps) const
{
int in, strin;
RecTangentialSolid (p, tansol, surfids, in, strin, eps);
@ -648,7 +648,7 @@ namespace netgen
}
void Solid :: RecTangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids,
void Solid :: RecTangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const
{
tansol = NULL;
@ -742,7 +742,7 @@ namespace netgen
void Solid :: TangentialSolid2 (const Point<3> & p,
const Vec<3> & t,
Solid *& tansol, Array<int> & surfids, double eps) const
Solid *& tansol, NgArray<int> & surfids, double eps) const
{
int in, strin;
surfids.SetSize (0);
@ -752,7 +752,7 @@ namespace netgen
}
void Solid :: RecTangentialSolid2 (const Point<3> & p, const Vec<3> & t,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const
{
tansol = NULL;
@ -856,7 +856,7 @@ namespace netgen
void Solid :: TangentialSolid3 (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
double eps) const
{
int in, strin;
@ -869,7 +869,7 @@ namespace netgen
void Solid :: RecTangentialSolid3 (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const
{
tansol = NULL;
@ -967,7 +967,7 @@ namespace netgen
void Solid :: TangentialEdgeSolid (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, const Vec<3> & m,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
double eps) const
{
int in, strin;
@ -982,7 +982,7 @@ namespace netgen
void Solid :: RecTangentialEdgeSolid (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, const Vec<3> & m,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const
{
tansol = NULL;
@ -1450,13 +1450,13 @@ namespace netgen
return 0;
}
void Solid :: GetSurfaceIndices (Array<int> & surfind) const
void Solid :: GetSurfaceIndices (NgArray<int> & surfind) const
{
surfind.SetSize (0);
RecGetSurfaceIndices (surfind);
}
void Solid :: RecGetSurfaceIndices (Array<int> & surfind) const
void Solid :: RecGetSurfaceIndices (NgArray<int> & surfind) const
{
switch (op)
{
@ -1533,13 +1533,13 @@ namespace netgen
}
void Solid :: GetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfind, double eps) const
void Solid :: GetTangentialSurfaceIndices (const Point<3> & p, NgArray<int> & surfind, double eps) const
{
surfind.SetSize (0);
RecGetTangentialSurfaceIndices (p, surfind, eps);
}
void Solid :: RecGetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfind, double eps) const
void Solid :: RecGetTangentialSurfaceIndices (const Point<3> & p, NgArray<int> & surfind, double eps) const
{
switch (op)
{
@ -1576,14 +1576,14 @@ namespace netgen
void Solid :: GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
surfind.SetSize (0);
RecGetTangentialSurfaceIndices2 (p, v, surfind, eps);
}
void Solid :: RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
switch (op)
{
@ -1628,14 +1628,14 @@ namespace netgen
void Solid :: GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
surfind.SetSize (0);
RecGetTangentialSurfaceIndices3 (p, v, v2, surfind, eps);
}
void Solid :: RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
switch (op)
{
@ -1697,7 +1697,7 @@ namespace netgen
void Solid :: RecGetTangentialEdgeSurfaceIndices (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, const Vec<3> & m,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
switch (op)
{
@ -1801,7 +1801,7 @@ namespace netgen
}
void Solid :: CalcOnePrimitiveSpecialPoints (const Box<3> & box, Array<Point<3> > & pts) const
void Solid :: CalcOnePrimitiveSpecialPoints (const Box<3> & box, NgArray<Point<3> > & pts) const
{
double eps = 1e-8 * box.Diam ();
@ -1814,7 +1814,7 @@ namespace netgen
}
}
void Solid :: RecCalcOnePrimitiveSpecialPoints (Array<Point<3> > & pts) const
void Solid :: RecCalcOnePrimitiveSpecialPoints (NgArray<Point<3> > & pts) const
{
switch (op)
{

View File

@ -81,14 +81,14 @@ namespace netgen
void IterateSolid (SolidIterator & it, bool only_once = 0);
void Boundaries (const Point<3> & p, Array<int> & bounds) const;
void Boundaries (const Point<3> & p, NgArray<int> & bounds) const;
int NumPrimitives () const;
void GetSurfaceIndices (Array<int> & surfind) const;
void GetSurfaceIndices (NgArray<int> & surfind) const;
void GetSurfaceIndices (IndexSet & iset) const;
void GetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, Array<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices (const Point<3> & p, NgArray<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, NgArray<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, NgArray<int> & surfids, double eps) const;
void ForEachSurface (const std::function<void(Surface*,bool)> & lambda, bool inv = false) const;
@ -114,16 +114,16 @@ namespace netgen
/// compute localization in point p
void TangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids, double eps) const;
void TangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids, double eps) const;
/// compute localization in point p tangential to vector t
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
Solid *& tansol, Array<int> & surfids, double eps) const;
Solid *& tansol, NgArray<int> & surfids, double eps) const;
/** compute localization in point p, with second order approximation to edge
p + s t + s*s/2 t2 **/
void TangentialSolid3 (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
Solid *& tansol, Array<int> & surfids, double eps) const;
Solid *& tansol, NgArray<int> & surfids, double eps) const;
@ -135,10 +135,10 @@ namespace netgen
**/
void TangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
const Vec<3> & m,
Solid *& tansol, Array<int> & surfids, double eps) const;
Solid *& tansol, NgArray<int> & surfids, double eps) const;
void CalcOnePrimitiveSpecialPoints (const Box<3> & box, Array<Point<3> > & pts) const;
void CalcOnePrimitiveSpecialPoints (const Box<3> & box, NgArray<Point<3> > & pts) const;
///
int Edge (const Point<3> & p, const Vec<3> & v, double eps) const;
@ -176,23 +176,23 @@ namespace netgen
protected:
///
void RecBoundaries (const Point<3> & p, Array<int> & bounds,
void RecBoundaries (const Point<3> & p, NgArray<int> & bounds,
int & in, int & strin) const;
///
void RecTangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids,
void RecTangentialSolid (const Point<3> & p, Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const;
void RecTangentialSolid2 (const Point<3> & p, const Vec<3> & vec,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const;
///
void RecTangentialSolid3 (const Point<3> & p, const Vec<3> & vec,const Vec<3> & vec2,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const;
///
void RecTangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
const Vec<3> & m,
Solid *& tansol, Array<int> & surfids,
Solid *& tansol, NgArray<int> & surfids,
int & in, int & strin, double eps) const;
///
@ -203,16 +203,16 @@ namespace netgen
///
Solid * RecGetReducedSolid (const BoxSphere<3> & box, INSOLID_TYPE & in) const;
///
void RecGetSurfaceIndices (Array<int> & surfind) const;
void RecGetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
void RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
void RecGetSurfaceIndices (NgArray<int> & surfind) const;
void RecGetTangentialSurfaceIndices (const Point<3> & p, NgArray<int> & surfids, double eps) const;
void RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, NgArray<int> & surfids, double eps) const;
void RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
Array<int> & surfids, double eps) const;
NgArray<int> & surfids, double eps) const;
void RecGetTangentialEdgeSurfaceIndices (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, const Vec<3> & m,
Array<int> & surfids, double eps) const;
NgArray<int> & surfids, double eps) const;
void RecGetSurfaceIndices (IndexSet & iset) const;
void RecCalcOnePrimitiveSpecialPoints (Array<Point<3> > & pts) const;
void RecCalcOnePrimitiveSpecialPoints (NgArray<Point<3> > & pts) const;
friend class SolidIterator;
friend class ClearVisitedIt;

View File

@ -21,7 +21,7 @@
namespace netgen
{
Array<Box<3> > boxes;
NgArray<Box<3> > boxes;
void ProjectToEdge (const Surface * f1, const Surface * f2, Point<3> & hp);
@ -64,7 +64,7 @@ namespace netgen
}
static Array<int> numprim_hist;
static NgArray<int> numprim_hist;
SpecialPointCalculation :: SpecialPointCalculation ()
{
@ -73,7 +73,7 @@ namespace netgen
void SpecialPointCalculation ::
CalcSpecialPoints (const CSGeometry & ageometry,
Array<MeshPoint> & apoints)
NgArray<MeshPoint> & apoints)
{
static int timer = NgProfiler::CreateTimer ("CSG: find special points");
NgProfiler::RegionTimer reg (timer);
@ -112,7 +112,7 @@ namespace netgen
if (tlo->GetSolid())
{
Array<Point<3> > hpts;
NgArray<Point<3> > hpts;
tlo->GetSolid()->CalcOnePrimitiveSpecialPoints (box, hpts);
// if (hpts.Size())
// cout << "oneprimitivespecialpoints = " << hpts << endl;
@ -210,8 +210,8 @@ namespace netgen
bool possiblecrossp, possibleexp; // possible cross or extremalpoint
bool surecrossp = 0, sureexp = 0; // sure ...
// static Array<int> locsurf; // attention: array is static
ArrayMem<int,100> locsurf;
// static NgArray<int> locsurf; // attention: array is static
NgArrayMem<int,100> locsurf;
// static int cntbox = 0;
// cntbox++;
@ -273,8 +273,8 @@ namespace netgen
if (nquad == numprim && nplane >= numprim-1)
{
Array<Point<3> > pts;
Array<int> surfids;
NgArray<Point<3> > pts;
NgArray<int> surfids;
for (int k1 = 0; k1 < numprim - 2; k1++)
for (int k2 = k1 + 1; k2 < numprim - 1; k2++)
@ -392,8 +392,8 @@ namespace netgen
if (nsphere == numprim) // && calccp == false)
{
Array<Point<3> > pts;
Array<int> surfids;
NgArray<Point<3> > pts;
NgArray<int> surfids;
@ -541,7 +541,7 @@ namespace netgen
BoxSphere<3> boxp (pp, pp);
boxp.Increase (1e-3*size);
boxp.CalcDiamCenter();
Array<int> locsurf2;
NgArray<int> locsurf2;
geometry -> GetIndependentSurfaceIndices (sol, boxp, locsurf2);
@ -1132,7 +1132,7 @@ namespace netgen
ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const Plane * plane3,
Array<Point<3> > & pts)
NgArray<Point<3> > & pts)
{
Mat<3> mat;
Vec<3> rhs, sol;
@ -1174,7 +1174,7 @@ namespace netgen
ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const QuadraticSurface * quadric,
Array<Point<3> > & pts)
NgArray<Point<3> > & pts)
{
Mat<2,3> mat;
Mat<3,2> inv;
@ -1244,7 +1244,7 @@ namespace netgen
ComputeCrossPoints (const Sphere * sphere1,
const Sphere * sphere2,
const Sphere * sphere3,
Array<Point<3> > & pts)
NgArray<Point<3> > & pts)
{
Mat<2,3> mat;
Mat<3,2> inv;
@ -1327,7 +1327,7 @@ namespace netgen
void SpecialPointCalculation ::
ComputeExtremalPoints (const Plane * plane,
const QuadraticSurface * quadric,
Array<Point<3> > & pts)
NgArray<Point<3> > & pts)
{
// 3 equations:
// surf1 = 0 <===> plane_a + plane_b x = 0;
@ -1416,7 +1416,7 @@ namespace netgen
void SpecialPointCalculation ::
ComputeExtremalPoints (const Sphere * sphere1,
const Sphere * sphere2,
Array<Point<3> > & pts)
NgArray<Point<3> > & pts)
{
// 3 equations:
// surf1 = 0 <===> |x-c1|^2 - r1^2 = 0;
@ -1666,19 +1666,19 @@ namespace netgen
void SpecialPointCalculation ::
AnalyzeSpecialPoints (const CSGeometry & ageometry,
Array<MeshPoint> & apoints,
Array<SpecialPoint> & specpoints)
NgArray<MeshPoint> & apoints,
NgArray<SpecialPoint> & specpoints)
{
static int timer = NgProfiler::CreateTimer ("CSG: analyze special points");
NgProfiler::RegionTimer reg (timer);
Array<int> surfind, rep_surfind, surfind2, rep_surfind2, surfind3;
NgArray<int> surfind, rep_surfind, surfind2, rep_surfind2, surfind3;
Array<Vec<3> > normalvecs;
NgArray<Vec<3> > normalvecs;
Vec<3> nsurf = 0.0;
Array<int> specpoint2point;
NgArray<int> specpoint2point;
specpoints.SetSize (0);
geometry = &ageometry;
@ -1698,7 +1698,7 @@ namespace netgen
*/
Vec<3> dir(1.2, 1.7, 0.9);
Array<double> coord(apoints.Size());
NgArray<double> coord(apoints.Size());
for (int i = 0; i < apoints.Size(); i++)
coord[i] = dir * Vec<3> (apoints[i]);
@ -1717,7 +1717,7 @@ namespace netgen
(*testout) << "points = " << apoints << endl;
Point3dTree searchtree (bbox.PMin(), bbox.PMax());
Array<int> locsearch;
NgArray<int> locsearch;
for (int si = 0; si < ageometry.GetNTopLevelObjects(); si++)
{
@ -1882,7 +1882,7 @@ namespace netgen
#ifdef DEVELOP
(*testout) << "surfind2 = " << endl << surfind2 << endl;
#endif
Array<int> surfind2_aux(surfind2);
NgArray<int> surfind2_aux(surfind2);
ageometry.GetIndependentSurfaceIndices (surfind2_aux);
#ifdef DEVELOP
(*testout) << "surfind2,rep = " << endl << surfind2_aux << endl;
@ -2067,7 +2067,7 @@ namespace netgen
if(testuncond.Test(i))
continue;
Array<int> same;
NgArray<int> same;
same.Append(i);
for(int j = i+1; j<specpoints.Size(); j++)

View File

@ -79,9 +79,9 @@ namespace netgen
///
const CSGeometry * geometry;
///
Array<MeshPoint> * points;
NgArray<MeshPoint> * points;
///
Array<long int> boxesinlevel;
NgArray<long int> boxesinlevel;
///
double size;
@ -102,11 +102,11 @@ namespace netgen
///
void CalcSpecialPoints (const CSGeometry & ageometry,
Array<MeshPoint> & points);
NgArray<MeshPoint> & points);
///
void AnalyzeSpecialPoints (const CSGeometry & geometry,
Array<MeshPoint> & points,
Array<SpecialPoint> & specpoints);
NgArray<MeshPoint> & points,
NgArray<SpecialPoint> & specpoints);
protected:
///
@ -161,27 +161,27 @@ namespace netgen
void ComputeExtremalPoints (const Plane * plane,
const QuadraticSurface * quadric,
Array<Point<3> > & pts);
NgArray<Point<3> > & pts);
void ComputeExtremalPoints (const Sphere * sphere1,
const Sphere * sphere2,
Array<Point<3> > & pts);
NgArray<Point<3> > & pts);
void ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const Plane * plane3,
Array<Point<3> > & pts);
NgArray<Point<3> > & pts);
void ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const QuadraticSurface * quadratic,
Array<Point<3> > & pts);
NgArray<Point<3> > & pts);
void ComputeCrossPoints (const Sphere * sphere1,
const Sphere * sphere2,
const Sphere * sphere3,
Array<Point<3> > & pts);
NgArray<Point<3> > & pts);
};
}

View File

@ -27,7 +27,7 @@ namespace netgen
class spline3d
{
///
Array<splinesegment3d *> segments;
NgArray<splinesegment3d *> segments;
public:
///

View File

@ -36,11 +36,11 @@ void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const
return "default";
}
const shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> SplineSurface :: CreateCuttingSurfaces()
const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> SplineSurface :: CreateCuttingSurfaces()
{
if(all_cuts)
return all_cuts;
auto cuttings = make_shared<Array<shared_ptr<OneSurfacePrimitive>>>();
auto cuttings = make_shared<NgArray<shared_ptr<OneSurfacePrimitive>>>();
for (auto cut : *cuts)
cuttings->Append(cut);
for(int i = 0; i<splines.Size(); i++)

View File

@ -7,16 +7,16 @@ namespace netgen
class SplineSurface : public OneSurfacePrimitive
{
protected:
Array<GeomPoint<3>> geompoints;
Array<shared_ptr<SplineSeg<3>>> splines;
Array<string> bcnames;
Array<double> maxh;
NgArray<GeomPoint<3>> geompoints;
NgArray<shared_ptr<SplineSeg<3>>> splines;
NgArray<string> bcnames;
NgArray<double> maxh;
shared_ptr<OneSurfacePrimitive> baseprimitive;
shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> cuts;
shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> all_cuts;
shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> cuts;
shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> all_cuts;
public:
SplineSurface(shared_ptr<OneSurfacePrimitive> abaseprimitive, shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> acuts) :
SplineSurface(shared_ptr<OneSurfacePrimitive> abaseprimitive, shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> acuts) :
OneSurfacePrimitive(), baseprimitive(abaseprimitive), cuts(acuts)
{ ; }
// default constructor for archive
@ -25,7 +25,7 @@ namespace netgen
const auto & GetSplines() const { return splines; }
int GetNSplines() const { return splines.Size(); }
const Array<GeomPoint<3>>& GetPoints() const { return geompoints; }
const NgArray<GeomPoint<3>>& GetPoints() const { return geompoints; }
string GetSplineType(const int i) const { return splines[i]->GetType(); }
SplineSeg<3> & GetSpline(const int i) { return *splines[i]; }
const SplineSeg<3> & GetSpline(const int i) const { return *splines[i]; }
@ -37,8 +37,8 @@ namespace netgen
DLL_HEADER void AppendPoint(const Point<3> & p, const double reffac = 1., const bool hpref=false);
void AppendSegment(shared_ptr<SplineSeg<3>> spline, string & bcname, double amaxh = -1);
const shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> CreateCuttingSurfaces();
const shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> GetCuts() const { return all_cuts; }
const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> CreateCuttingSurfaces();
const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> GetCuts() const { return all_cuts; }
const shared_ptr<OneSurfacePrimitive> GetBase() const { return baseprimitive; }
virtual void Project (Point<3> & p3d) const { baseprimitive->Project(p3d); }
@ -50,7 +50,7 @@ namespace netgen
{ return baseprimitive->HesseNorm(); }
virtual Point<3> GetSurfacePoint () const
{ return baseprimitive->GetSurfacePoint(); }
virtual void CalcSpecialPoints(Array<Point<3>> & pts) const
virtual void CalcSpecialPoints(NgArray<Point<3>> & pts) const
{ baseprimitive->CalcSpecialPoints(pts); }
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const
@ -67,7 +67,7 @@ namespace netgen
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual double HesseNorm () const;
virtual Point<3> GetSurfacePoint () const;
virtual void CalcSpecialPoints(Array<Point<3>> & pts) const;
virtual void CalcSpecialPoints(NgArray<Point<3>> & pts) const;
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const;

View File

@ -230,13 +230,13 @@ void Primitive :: SetSurfaceId (int i, int id)
void Primitive :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const
NgArray<double> & coeffs) const
{
classname = "undef";
coeffs.SetSize (0);
}
void Primitive :: SetPrimitiveData (Array<double> & coeffs)
void Primitive :: SetPrimitiveData (NgArray<double> & coeffs)
{
;
}
@ -277,7 +277,7 @@ void Primitive :: Transform (Transformation<3> & trans)
}
void Primitive :: GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
for (int j = 0; j < GetNSurfaces(); j++)
if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps)
@ -288,7 +288,7 @@ void Primitive :: GetTangentialSurfaceIndices (const Point<3> & p,
void Primitive ::
GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
cout << "get tangvecsurfind not implemented" << endl;
surfind.SetSize (0);
@ -296,7 +296,7 @@ GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
void Primitive ::
GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const
NgArray<int> & surfind, double eps) const
{
for (int j = 0; j < GetNSurfaces(); j++)
{

View File

@ -241,8 +241,8 @@ namespace netgen
class Primitive
{
protected:
Array<int> surfaceids;
Array<int> surfaceactive;
NgArray<int> surfaceids;
NgArray<int> surfaceactive;
public:
@ -268,7 +268,7 @@ namespace netgen
double eps) const = 0;
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
@ -294,15 +294,15 @@ namespace netgen
double eps) const;
virtual void GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const;
NgArray<int> & surfind, double eps) const;
virtual void CalcSpecialPoints (Array<Point<3> > & /* pts */) const { ; }
virtual void CalcSpecialPoints (NgArray<Point<3> > & /* pts */) const { ; }
virtual void AnalyzeSpecialPoint (const Point<3> & /* pt */,
Array<Point<3> > & /* specpts */) const { ; }
NgArray<Point<3> > & /* specpts */) const { ; }
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & /* p */,
int /* s1 */, int /* s2 */) const
{ return Vec<3> (0,0,0); }
@ -318,8 +318,8 @@ namespace netgen
virtual int SurfaceInverted (int /* i */ = 0) const { return 0; }
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (NgArray<double> & coeffs);
static Primitive * CreatePrimitive (const char * classname);

View File

@ -29,7 +29,7 @@ namespace netgen
void TriangleApproximation :: RemoveUnusedPoints ()
{
BitArray used(GetNP());
Array<int> map (GetNP());
NgArray<int> map (GetNP());
int i, j;
int cnt = 0;

View File

@ -36,9 +36,9 @@ namespace netgen
class TriangleApproximation
{
Array<Point<3> > points;
Array<Vec<3> > normals;
Array<TATriangle> trigs;
NgArray<Point<3> > points;
NgArray<Vec<3> > normals;
NgArray<TATriangle> trigs;
public:
TriangleApproximation();

View File

@ -18,8 +18,8 @@ namespace netgen
/* *********************** Draw Geometry **************** */
extern shared_ptr<Mesh> mesh;
extern Array<SpecialPoint> specpoints;
extern Array<Box<3> > boxes;
extern NgArray<SpecialPoint> specpoints;
extern NgArray<Box<3> > boxes;

View File

@ -13,7 +13,7 @@ namespace netgen
class DLL_HEADER VisualSceneGeometry : public VisualScene
{
class CSGeometry * geometry;
Array<int> trilists;
NgArray<int> trilists;
int selsurf;
public:
VisualSceneGeometry ();

View File

@ -211,7 +211,7 @@ namespace netgen
{
int i, j;
int nseg = mesh.GetNSeg();
Array<int> edgesonpoint(mesh.GetNP());
NgArray<int> edgesonpoint(mesh.GetNP());
for (i = 1; i <= mesh.GetNP(); i++)
edgesonpoint.Elem(i) = 0;
@ -251,9 +251,9 @@ namespace netgen
// markers for z-refinement: p1, p2, levels
// p1-p2 is an edge to be refined
Array<INDEX_3> ref_uniform;
Array<INDEX_3> ref_singular;
Array<INDEX_4 > ref_slices;
NgArray<INDEX_3> ref_uniform;
NgArray<INDEX_3> ref_singular;
NgArray<INDEX_4 > ref_slices;
BitArray first_id(geom->identifications.Size());
first_id.Set();
@ -287,7 +287,7 @@ namespace netgen
}
else
{
//const Array<double> & slices = csid->GetSlices();
//const NgArray<double> & slices = csid->GetSlices();
INDEX_4 i4;
i4[0] = pair.I1();
i4[1] = pair.I2();
@ -301,7 +301,7 @@ namespace netgen
Array<EdgePointGeomInfo> epgi;
NgArray<EdgePointGeomInfo> epgi;
while (1)
{
@ -389,7 +389,7 @@ namespace netgen
edge.Sort();
if (!refedges.Used(edge))
{
const Array<double> & slices = csid->GetSlices();
const NgArray<double> & slices = csid->GetSlices();
//(*testout) << "idnr " << idnr << " i " << i << endl;
//(*testout) << "slices " << slices << endl;
double slicefac = slices.Get(slicenr);

View File

@ -2,14 +2,14 @@ add_definitions(-DNGINTERFACE_EXPORTS)
add_library(gen INTERFACE)
set(sdir ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(gen INTERFACE
${sdir}/array.cpp ${sdir}/bitarray.cpp ${sdir}/dynamicmem.cpp ${sdir}/flags.cpp
${sdir}/ngarray.cpp ${sdir}/bitarray.cpp ${sdir}/dynamicmem.cpp ${sdir}/flags.cpp
${sdir}/hashtabl.cpp ${sdir}/mystring.cpp ${sdir}/optmem.cpp ${sdir}/parthreads.cpp
${sdir}/seti.cpp ${sdir}/sort.cpp ${sdir}/spbita2d.cpp ${sdir}/table.cpp
${sdir}/mpi_interface.cpp ${sdir}/gzstream.cpp
)
install(FILES
array.hpp autodiff.hpp autoptr.hpp bitarray.hpp
ngarray.hpp autodiff.hpp autoptr.hpp bitarray.hpp
dynamicmem.hpp flags.hpp hashtabl.hpp mpi_interface.hpp myadt.hpp
ngsimd.hpp mystring.hpp netgenout.hpp ngpython.hpp
optmem.hpp parthreads.hpp seti.hpp sort.hpp

View File

@ -159,7 +159,7 @@ template <int BASE = 1>
class BitArrayChar
{
///
Array<char,BASE> data;
NgArray<char,BASE> data;
public:
///

View File

@ -56,9 +56,9 @@ namespace netgen
}
void Flags :: SetFlag (const char * name, const Array<char*> & val)
void Flags :: SetFlag (const char * name, const NgArray<char*> & val)
{
Array<char*> * strarray = new Array<char*>;
NgArray<char*> * strarray = new NgArray<char*>;
for (int i = 1; i <= val.Size(); i++)
{
strarray->Append (new char[strlen(val.Get(i))+1]);
@ -67,9 +67,9 @@ namespace netgen
strlistflags.Set (name, strarray);
}
void Flags :: SetFlag (const char * name, const Array<double> & val)
void Flags :: SetFlag (const char * name, const NgArray<double> & val)
{
Array<double> * numarray = new Array<double>;
NgArray<double> * numarray = new NgArray<double>;
for (int i = 1; i <= val.Size(); i++)
numarray->Append (val.Get(i));
numlistflags.Set (name, numarray);
@ -118,26 +118,26 @@ namespace netgen
}
const Array<char*> &
const NgArray<char*> &
Flags :: GetStringListFlag (const char * name) const
{
if (strlistflags.Used (name))
return *strlistflags[name];
else
{
static Array<char*> dummy_array(0);
static NgArray<char*> dummy_array(0);
return dummy_array;
}
}
const Array<double> &
const NgArray<double> &
Flags ::GetNumListFlag (const char * name) const
{
if (numlistflags.Used (name))
return *numlistflags[name];
else
{
static Array<double> dummy_array(0);
static NgArray<double> dummy_array(0);
return dummy_array;
}
}

View File

@ -25,9 +25,9 @@ class Flags
///
SymbolTable<int> defflags;
///
SymbolTable<Array<char*>*> strlistflags;
SymbolTable<NgArray<char*>*> strlistflags;
///
SymbolTable<Array<double>*> numlistflags;
SymbolTable<NgArray<double>*> numlistflags;
public:
///
DLL_HEADER Flags ();
@ -43,9 +43,9 @@ public:
/// Sets boolean flag
DLL_HEADER void SetFlag (const char * name);
/// Sets string arary flag
DLL_HEADER void SetFlag (const char * name, const Array<char*> & val);
DLL_HEADER void SetFlag (const char * name, const NgArray<char*> & val);
/// Sets double array flag
DLL_HEADER void SetFlag (const char * name, const Array<double> & val);
DLL_HEADER void SetFlag (const char * name, const NgArray<double> & val);
/// Save flags to file
DLL_HEADER void SaveFlags (const char * filename) const;
@ -67,9 +67,9 @@ public:
/// Returns boolean flag
DLL_HEADER bool GetDefineFlag (const char * name) const;
/// Returns string list flag, empty array if not exist
DLL_HEADER const Array<char*> & GetStringListFlag (const char * name) const;
DLL_HEADER const NgArray<char*> & GetStringListFlag (const char * name) const;
/// Returns num list flag, empty array if not exist
DLL_HEADER const Array<double> & GetNumListFlag (const char * name) const;
DLL_HEADER const NgArray<double> & GetNumListFlag (const char * name) const;
/// Test, if string flag is defined

View File

@ -480,7 +480,7 @@ class BASE_INDEX_CLOSED_HASHTABLE
protected:
///
// MoveableArray<INDEX> hash;
Array<INDEX> hash;
NgArray<INDEX> hash;
///
int invalid;
public:
@ -556,7 +556,7 @@ class INDEX_CLOSED_HASHTABLE : public BASE_INDEX_CLOSED_HASHTABLE
{
///
// MoveableArray<T> cont;
Array<T> cont;
NgArray<T> cont;
public:
///
@ -653,7 +653,7 @@ class BASE_INDEX_2_CLOSED_HASHTABLE
protected:
///
// MoveableArray<INDEX_2> hash;
Array<INDEX_2> hash;
NgArray<INDEX_2> hash;
///
int invalid;
size_t mask;
@ -718,7 +718,7 @@ protected:
template <class T>
class INDEX_2_CLOSED_HASHTABLE : public BASE_INDEX_2_CLOSED_HASHTABLE
{
Array<T> cont;
NgArray<T> cont;
public:
INDEX_2_CLOSED_HASHTABLE (size_t size)
: BASE_INDEX_2_CLOSED_HASHTABLE(size), cont(RoundUp2(size))
@ -813,7 +813,7 @@ inline ostream & operator<< (ostream & ost, const INDEX_2_CLOSED_HASHTABLE<T> &
class BASE_INDEX_3_CLOSED_HASHTABLE
{
protected:
Array<INDEX_3> hash;
NgArray<INDEX_3> hash;
int invalid;
size_t mask;
@ -922,7 +922,7 @@ template <class T>
class INDEX_3_CLOSED_HASHTABLE : public BASE_INDEX_3_CLOSED_HASHTABLE
{
// MoveableArray<T,0> cont;
Array<T,0> cont;
NgArray<T,0> cont;
public:
INDEX_3_CLOSED_HASHTABLE (int size)
@ -1376,9 +1376,9 @@ inline size_t HashValue (INDEX_2 i2, size_t size) { return (113*size_t(i2[0])+si
///
size_t used;
///
Array<T_HASH> hash;
NgArray<T_HASH> hash;
///
Array<T> cont;
NgArray<T> cont;
public:
///
ClosedHashTable (size_t asize = 128)
@ -1391,7 +1391,7 @@ inline size_t HashValue (INDEX_2 i2, size_t size) { return (113*size_t(i2[0])+si
ClosedHashTable (ClosedHashTable && ht2) = default;
// who needs that ?
ClosedHashTable (FlatArray<T_HASH> _hash, FlatArray<T> _cont)
ClosedHashTable (NgFlatArray<T_HASH> _hash, NgFlatArray<T> _cont)
: size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
{
for (auto & v : hash)

View File

@ -95,7 +95,7 @@ namespace netgen
#endif
#ifdef PARALLEL
inline MPI_Comm MyMPI_SubCommunicator(MPI_Comm comm, Array<int> & procs)
inline MPI_Comm MyMPI_SubCommunicator(MPI_Comm comm, NgArray<int> & procs)
{
MPI_Comm subcomm;
MPI_Group gcomm, gsubcomm;
@ -105,7 +105,7 @@ namespace netgen
return subcomm;
}
#else
inline MPI_Comm MyMPI_SubCommunicator(MPI_Comm comm, Array<int> & procs)
inline MPI_Comm MyMPI_SubCommunicator(MPI_Comm comm, NgArray<int> & procs)
{ return comm; }
#endif
@ -147,20 +147,20 @@ namespace netgen
template <class T, int BASE>
inline void MyMPI_Send (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Send (NgFlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Send( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm);
}
template <class T, int BASE>
inline void MyMPI_Recv ( FlatArray<T, BASE> s, int src, int tag, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Recv ( NgFlatArray<T, BASE> s, int src, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Status status;
MPI_Recv( &s.First(), s.Size(), MyGetMPIType<T>(), src, tag, comm, &status);
}
template <class T, int BASE>
inline void MyMPI_Recv ( Array <T, BASE> & s, int src, int tag, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Recv ( NgArray <T, BASE> & s, int src, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Status status;
int len;
@ -172,7 +172,7 @@ namespace netgen
}
template <class T, int BASE>
inline int MyMPI_Recv ( Array <T, BASE> & s, int tag, MPI_Comm comm /* = ng_comm */)
inline int MyMPI_Recv ( NgArray <T, BASE> & s, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Status status;
int len;
@ -191,21 +191,21 @@ namespace netgen
/*
template <class T, int BASE>
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
inline void MyMPI_ISend (NgFlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
{
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
}
template <class T, int BASE>
inline void MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
inline void MyMPI_IRecv (NgFlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
{
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
}
*/
template <class T, int BASE>
inline MPI_Request MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
inline MPI_Request MyMPI_ISend (NgFlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
@ -214,7 +214,7 @@ namespace netgen
template <class T, int BASE>
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
inline MPI_Request MyMPI_IRecv (NgFlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm /* = ng_comm */)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
@ -223,7 +223,7 @@ namespace netgen
/*
template <class T, int BASE>
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag)
inline void MyMPI_ISend (NgFlatArray<T, BASE> s, int dest, int tag)
{
MPI_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &request);
@ -232,7 +232,7 @@ namespace netgen
template <class T, int BASE>
inline void MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag)
inline void MyMPI_IRecv (NgFlatArray<T, BASE> s, int dest, int tag)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &request);
@ -257,7 +257,7 @@ namespace netgen
MPI_Comm_size(comm, &ntasks);
MPI_Comm_rank(comm, &rank);
Array<MPI_Request> requests;
NgArray<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++)
if (dest != rank)
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
@ -288,8 +288,8 @@ namespace netgen
int rank = comm.Rank();
int ntasks = comm.Size();
Array<int> send_sizes(ntasks);
Array<int> recv_sizes(ntasks);
NgArray<int> send_sizes(ntasks);
NgArray<int> recv_sizes(ntasks);
for (int i = 0; i < ntasks; i++)
send_sizes[i] = send_data[i].Size();
@ -304,7 +304,7 @@ namespace netgen
for (int i = 0; i < ntasks; i++)
recv_data.SetEntrySize (i, recv_sizes[i], sizeof(T));
Array<MPI_Request> requests;
NgArray<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++)
if (dest != rank && send_data[dest].Size())
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
@ -336,7 +336,7 @@ namespace netgen
}
template <class T>
inline void MyMPI_Bcast (Array<T, 0> & s, NgMPI_Comm comm /* = ng_comm */)
inline void MyMPI_Bcast (NgArray<T, 0> & s, NgMPI_Comm comm /* = ng_comm */)
{
int size = s.Size();
MyMPI_Bcast (size, comm);
@ -346,7 +346,7 @@ namespace netgen
}
template <class T>
inline void MyMPI_Bcast (Array<T, 0> & s, int root, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Bcast (NgArray<T, 0> & s, int root, MPI_Comm comm /* = ng_comm */)
{
int id;
MPI_Comm_rank(comm, &id);
@ -359,19 +359,19 @@ namespace netgen
}
template <class T, class T2>
inline void MyMPI_Allgather (const T & send, FlatArray<T2> recv, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Allgather (const T & send, NgFlatArray<T2> recv, MPI_Comm comm /* = ng_comm */)
{
MPI_Allgather( const_cast<T*> (&send), 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
}
template <class T, class T2>
inline void MyMPI_Alltoall (FlatArray<T> send, FlatArray<T2> recv, MPI_Comm comm /* = ng_comm */)
inline void MyMPI_Alltoall (NgFlatArray<T> send, NgFlatArray<T2> recv, MPI_Comm comm /* = ng_comm */)
{
MPI_Alltoall( &send[0], 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
}
// template <class T, class T2>
// inline void MyMPI_Alltoall_Block (FlatArray<T> send, FlatArray<T2> recv, int blocklen, MPI_Comm comm = ng_comm)
// inline void MyMPI_Alltoall_Block (NgFlatArray<T> send, NgFlatArray<T2> recv, int blocklen, MPI_Comm comm = ng_comm)
// {
// MPI_Alltoall( &send[0], blocklen, MyGetMPIType<T>(), &recv[0], blocklen, MyGetMPIType<T2>(), comm);
// }

View File

@ -28,7 +28,7 @@ namespace netgen
#include "dynamicmem.hpp"
#include "template.hpp"
#include "array.hpp"
#include "ngarray.hpp"
#include "table.hpp"
#include "hashtabl.hpp"

View File

@ -39,13 +39,13 @@ public:
class Procs
{
const netgen::FlatArray<int> procs;
const netgen::NgFlatArray<int> procs;
public:
Procs ( const netgen::FlatArray<int> & aprocs ) : procs (aprocs) { ; }
Procs ( const netgen::NgFlatArray<int> & aprocs ) : procs (aprocs) { ; }
const netgen::FlatArray<int> & GetProcs () const { return procs; }
const netgen::NgFlatArray<int> & GetProcs () const { return procs; }
};

View File

@ -1,5 +1,5 @@
#ifndef FILE_NGSTD_ArrayCPP
#define FILE_NGSTD_ArrayCPP
#ifndef FILE_NGSTD_NgArrayCPP
#define FILE_NGSTD_NgArrayCPP
// necessary for SGI ????
/**************************************************************************/
@ -9,7 +9,7 @@
/**************************************************************************/
/*
Abstract data type Array
Abstract data type NgArray
*/
#include <mystdlib.h>
@ -65,11 +65,11 @@ namespace netgen
{
if (!actsize)
{
throw Exception ("Array should not be empty");
// cerr << "Array souldn't be empty";
throw Exception ("NgArray should not be empty");
// cerr << "NgArray souldn't be empty";
}
}
#endif
}
#endif
#endif // FILE_NGSTD_NgArrayCPP

View File

@ -1,8 +1,8 @@
#ifndef FILE_Array
#define FILE_Array
#ifndef NGARRAY_HPP_INCLUDED
#define NGARRAY_HPP_INCLUDED
/**************************************************************************/
/* File: array.hpp */
/* File: ngarray.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
@ -46,15 +46,15 @@ namespace netgen
template <typename T, int BASE = 0, typename TIND = int>
class FlatArray;
class NgFlatArray;
template <typename T, int BASE, typename TIND>
class ArrayIterator
{
FlatArray<T,BASE,TIND> ar;
NgFlatArray<T,BASE,TIND> ar;
TIND ind;
public:
ArrayIterator (FlatArray<T,BASE,TIND> aar, TIND ai) : ar(aar), ind(ai) { ; }
ArrayIterator (NgFlatArray<T,BASE,TIND> aar, TIND ai) : ar(aar), ind(ai) { ; }
ArrayIterator operator++ (int) { return ArrayIterator(ar, ind++); }
ArrayIterator operator++ () { return ArrayIterator(ar, ++ind); }
T operator*() const { return ar[ind]; }
@ -67,14 +67,14 @@ namespace netgen
/**
A simple array container.
Array represented by size and data-pointer.
NgArray represented by size and data-pointer.
No memory allocation and deallocation, must be provided by user.
Helper functions for printing.
Optional range check by macro RANGE_CHECK
*/
template <typename T, int BASE, typename TIND>
class FlatArray
class NgFlatArray
{
protected:
/// the size
@ -85,7 +85,7 @@ namespace netgen
typedef T TELEM;
/// provide size and memory
FlatArray (size_t asize, T * adata)
NgFlatArray (size_t asize, T * adata)
: size(asize), data(adata) { ; }
/// the size
@ -112,9 +112,9 @@ namespace netgen
}
template <typename T2, int B2>
IndirectArray<FlatArray, FlatArray<T2,B2> > operator[] (const FlatArray<T2,B2> & ia) const
IndirectArray<NgFlatArray, NgFlatArray<T2,B2> > operator[] (const NgFlatArray<T2,B2> & ia) const
{
return IndirectArray<FlatArray, FlatArray<T2,B2> > (*this, ia);
return IndirectArray<NgFlatArray, NgFlatArray<T2,B2> > (*this, ia);
}
@ -124,7 +124,7 @@ namespace netgen
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name()
cout << "NgArray<" << typeid(T).name()
<< ">::Elem out of range, i = " << i
<< ", s = " << size << endl;
#endif
@ -137,7 +137,7 @@ namespace netgen
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name() << ">::Get out of range, i = " << i
cout << "NgArray<" << typeid(T).name() << ">::Get out of range, i = " << i
<< ", s = " << size << endl;
#endif
@ -149,7 +149,7 @@ namespace netgen
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name() << ">::Set out of range, i = " << i
cout << "NgArray<" << typeid(T).name() << ">::Set out of range, i = " << i
<< ", s = " << size << endl;
#endif
@ -170,7 +170,7 @@ namespace netgen
}
/// Fill array with value val
FlatArray & operator= (const T & val)
NgFlatArray & operator= (const T & val)
{
for (int i = 0; i < size; i++)
data[i] = val;
@ -178,9 +178,9 @@ namespace netgen
}
/// takes range starting from position start of end-start elements
const FlatArray<T> Range (TIND start, TIND end)
const NgFlatArray<T> Range (TIND start, TIND end)
{
return FlatArray<T> (end-start, data+start);
return NgFlatArray<T> (end-start, data+start);
}
/// first position of element elem, returns -1 if element not contained in array
@ -203,7 +203,7 @@ namespace netgen
// print array
template <typename T, int BASE, typename TIND>
inline ostream & operator<< (ostream & s, const FlatArray<T,BASE,TIND> & a)
inline ostream & operator<< (ostream & s, const NgFlatArray<T,BASE,TIND> & a)
{
for (TIND i = a.Begin(); i < a.End(); i++)
s << i << ": " << a[i] << endl;
@ -215,17 +215,17 @@ namespace netgen
/**
Dynamic array container.
Array<T> is an automatically increasing array container.
NgArray<T> is an automatically increasing array container.
The allocated memory doubles on overflow.
Either the container takes care of memory allocation and deallocation,
or the user provides one block of data.
*/
template <class T, int BASE = 0, typename TIND = int>
class Array : public FlatArray<T, BASE, TIND>
class NgArray : public NgFlatArray<T, BASE, TIND>
{
protected:
using FlatArray<T,BASE,TIND>::size;
using FlatArray<T,BASE,TIND>::data;
using NgFlatArray<T,BASE,TIND>::size;
using NgFlatArray<T,BASE,TIND>::data;
/// physical size of array
size_t allocsize;
@ -235,31 +235,31 @@ namespace netgen
public:
/// Generate array of logical and physical size asize
explicit Array()
: FlatArray<T, BASE, TIND> (0, NULL)
explicit NgArray()
: NgFlatArray<T, BASE, TIND> (0, NULL)
{
allocsize = 0;
ownmem = 1;
}
explicit Array(size_t asize)
: FlatArray<T, BASE, TIND> (asize, asize ? new T[asize] : nullptr)
explicit NgArray(size_t asize)
: NgFlatArray<T, BASE, TIND> (asize, asize ? new T[asize] : nullptr)
{
allocsize = asize;
ownmem = (asize == 0) ? 0 : 1;
}
/// Generate array in user data
Array(TIND asize, T* adata)
: FlatArray<T, BASE, TIND> (asize, adata)
NgArray(TIND asize, T* adata)
: NgFlatArray<T, BASE, TIND> (asize, adata)
{
allocsize = asize;
ownmem = 0;
}
/// array copy
explicit Array (const Array<T,BASE,TIND> & a2)
: FlatArray<T, BASE, TIND> (a2.Size(), a2.Size() ? new T[a2.Size()] : 0)
explicit NgArray (const NgArray<T,BASE,TIND> & a2)
: NgFlatArray<T, BASE, TIND> (a2.Size(), a2.Size() ? new T[a2.Size()] : 0)
{
allocsize = size;
ownmem = 1;
@ -268,8 +268,8 @@ namespace netgen
}
/// array move
Array (Array && a2)
: FlatArray<T,BASE,TIND> (a2.size, a2.data), allocsize(a2.allocsize), ownmem(a2.ownmem)
NgArray (NgArray && a2)
: NgFlatArray<T,BASE,TIND> (a2.size, a2.data), allocsize(a2.allocsize), ownmem(a2.ownmem)
{
a2.size = 0;
a2.data = nullptr;
@ -279,7 +279,7 @@ namespace netgen
/// if responsible, deletes memory
~Array()
~NgArray()
{
if (ownmem)
delete [] data;
@ -312,7 +312,7 @@ namespace netgen
}
template <typename T2, int B2>
void Append (FlatArray<T2, B2> a2)
void Append (NgFlatArray<T2, B2> a2)
{
if (size+a2.Size() > allocsize)
ReSize (size+a2.Size());
@ -362,14 +362,14 @@ namespace netgen
}
/// Fill array with val
Array & operator= (const T & val)
NgArray & operator= (const T & val)
{
FlatArray<T, BASE, TIND>::operator= (val);
NgFlatArray<T, BASE, TIND>::operator= (val);
return *this;
}
/// array copy
Array & operator= (const Array & a2)
NgArray & operator= (const NgArray & a2)
{
SetSize (a2.Size());
for (TIND i (BASE); i < size+BASE; i++)
@ -378,7 +378,7 @@ namespace netgen
}
/// array copy
Array & operator= (const FlatArray<T> & a2)
NgArray & operator= (const NgFlatArray<T> & a2)
{
SetSize (a2.Size());
for (TIND i = BASE; i < size+BASE; i++)
@ -386,12 +386,12 @@ namespace netgen
return *this;
}
Array & operator= (Array && a2)
NgArray & operator= (NgArray && a2)
{
Swap (data, a2.data);
Swap (size, a2.size);
Swap (allocsize, a2.allocsize);
Swap (ownmem, a2.ownmem);
ngcore::Swap (data, a2.data);
ngcore::Swap (size, a2.size);
ngcore::Swap (allocsize, a2.allocsize);
ngcore::Swap (ownmem, a2.ownmem);
return *this;
}
@ -429,16 +429,11 @@ namespace netgen
T * p = new T[nsize];
size_t mins = (nsize < size) ? nsize : size;
// memcpy (p, data, mins * sizeof(T));
#if defined(__GNUG__) && __GNUC__ < 5 && !defined(__clang__)
for (size_t i = 0; i < mins; i++) p[i] = move(data[i]);
#else
if (std::is_trivially_copyable<T>::value)
if constexpr(std::is_trivially_copyable<T>::value)
memcpy (p, data, sizeof(T)*mins);
else
for (size_t i = 0; i < mins; i++) p[i] = move(data[i]);
#endif
if (ownmem)
delete [] data;
@ -458,19 +453,19 @@ namespace netgen
template <class T, int S>
class ArrayMem : public Array<T>
class NgArrayMem : public NgArray<T>
{
using Array<T>::size;
using Array<T>::data;
using Array<T>::ownmem;
using NgArray<T>::size;
using NgArray<T>::data;
using NgArray<T>::ownmem;
T mem[S]; // Intel C++ calls dummy constructor
// char mem[S*sizeof(T)];
// double mem[(S*sizeof(T)+7) / 8];
public:
/// Generate array of logical and physical size asize
explicit ArrayMem(size_t asize = 0)
: Array<T> (S, static_cast<T*> (static_cast<void*>(&mem[0])))
explicit NgArrayMem(size_t asize = 0)
: NgArray<T> (S, static_cast<T*> (static_cast<void*>(&mem[0])))
{
size = asize;
if (asize > S)
@ -481,14 +476,14 @@ namespace netgen
// SetSize (asize);
}
ArrayMem & operator= (const T & val)
NgArrayMem & operator= (const T & val)
{
Array<T>::operator= (val);
NgArray<T>::operator= (val);
return *this;
}
/// array copy
ArrayMem & operator= (const FlatArray<T> & a2)
NgArrayMem & operator= (const NgFlatArray<T> & a2)
{
this->SetSize (a2.Size());
for (size_t i = 0; i < size; i++)
@ -505,11 +500,11 @@ namespace netgen
template <class T, int B1, int B2>
class IndirectArray
{
const FlatArray<T, B1> & array;
const FlatArray<int, B2> & ia;
const NgFlatArray<T, B1> & array;
const NgFlatArray<int, B2> & ia;
public:
IndirectArray (const FlatArray<T,B1> & aa, const FlatArray<int, B2> & aia)
IndirectArray (const NgFlatArray<T,B1> & aa, const NgFlatArray<int, B2> & aia)
: array(aa), ia(aia) { ; }
int Size() const { return ia.Size(); }
const T & operator[] (int i) const { return array[ia[i]]; }
@ -703,7 +698,7 @@ namespace netgen
/// bubble sort array
template <class T>
inline void BubbleSort (const FlatArray<T> & data)
inline void BubbleSort (const NgFlatArray<T> & data)
{
for (int i = 0; i < data.Size(); i++)
for (int j = i+1; j < data.Size(); j++)
@ -717,7 +712,7 @@ namespace netgen
/// bubble sort array
template <class T, class S>
inline void BubbleSort (FlatArray<T> & data, FlatArray<S> & slave)
inline void BubbleSort (NgFlatArray<T> & data, NgFlatArray<S> & slave)
{
for (int i = 0; i < data.Size(); i++)
for (int j = i+1; j < data.Size(); j++)
@ -735,8 +730,8 @@ namespace netgen
template <class T, class S>
void QuickSortRec (FlatArray<T> & data,
FlatArray<S> & slave,
void QuickSortRec (NgFlatArray<T> & data,
NgFlatArray<S> & slave,
int left, int right)
{
int i = left;
@ -750,8 +745,8 @@ namespace netgen
if (i <= j)
{
Swap (data[i], data[j]);
Swap (slave[i], slave[j]);
ngcore::Swap (data[i], data[j]);
ngcore::Swap (slave[i], slave[j]);
i++; j--;
}
}
@ -761,7 +756,7 @@ namespace netgen
}
template <class T, class S>
void QuickSort (FlatArray<T> & data, FlatArray<S> & slave)
void QuickSort (NgFlatArray<T> & data, NgFlatArray<S> & slave)
{
if (data.Size() > 1)
QuickSortRec (data, slave, 0, data.Size()-1);
@ -776,8 +771,8 @@ namespace netgen
template <class T>
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2,
Array<T> & out)
void Intersection (const NgFlatArray<T> & in1, const NgFlatArray<T> & in2,
NgArray<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
@ -785,8 +780,8 @@ namespace netgen
out.Append(in1[i]);
}
template <class T>
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const FlatArray<T> & in3,
Array<T> & out)
void Intersection (const NgFlatArray<T> & in1, const NgFlatArray<T> & in2, const NgFlatArray<T> & in3,
NgArray<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
@ -795,5 +790,5 @@ namespace netgen
}
}
#endif
#endif // NGARRAY_HPP_INCLUDED

View File

@ -13,6 +13,8 @@
#include <string>
#include <type_traits>
#include <core/utils.hpp>
#ifdef WIN32
#ifndef AVX_OPERATORS_DEFINED
#define AVX_OPERATORS_DEFINED
@ -48,6 +50,7 @@ NG_INLINE __m256d operator/= (__m256d &a, __m256d b) { return a = a/b; }
namespace ngsimd
{
using ngcore::AlignedAlloc;
// MSVC does not define SSE. It's always present on 64bit cpus
#if (defined(_M_AMD64) || defined(_M_X64) || defined(__AVX__))
@ -121,42 +124,6 @@ namespace ngsimd
NG_INLINE SIMD<double,N> operator/ (SIMD<double,N> a, T b) { return a / SIMD<double,N>(b); }
#ifdef __AVX__
template <typename T>
class AlignedAlloc
{
protected:
static void * aligned_malloc(size_t s)
{
// Assume 16 byte alignment of standard library
if(alignof(T)<=16)
return malloc(s);
else
return _mm_malloc(s, alignof(T));
}
static void aligned_free(void *p)
{
if(alignof(T)<=16)
free(p);
else
_mm_free(p);
}
public:
void * operator new (size_t s, void *p) { return p; }
void * operator new (size_t s) { return aligned_malloc(s); }
void * operator new[] (size_t s) { return aligned_malloc(s); }
void operator delete (void * p) { aligned_free(p); }
void operator delete[] (void * p) { aligned_free(p); }
};
#else
// it's only a dummy without AVX
template <typename T>
class AlignedAlloc { ; };
#endif
using std::sqrt;
using std::fabs;

View File

@ -5,7 +5,7 @@
/**************************************************************************/
/*
Abstract data type Array
Abstract data type NgArray
*/

View File

@ -22,7 +22,7 @@ private:
///
void * freelist;
///
Array<char*> bablocks;
NgArray<char*> bablocks;
mutex block_allocator_mutex;
public:
///

View File

@ -16,7 +16,7 @@ namespace netgen
*/
class IndexSet
{
Array<int> set;
NgArray<int> set;
BitArray flags;
public:
IndexSet (int maxind);
@ -41,7 +41,7 @@ public:
void Del (int ind);
void Clear ();
const Array<int> & GetArray() { return set; }
const NgArray<int> & GetArray() { return set; }
};
}

View File

@ -16,8 +16,8 @@
namespace netgen
{
void Sort (const Array<double> & values,
Array<int> & order)
void Sort (const NgArray<double> & values,
NgArray<int> & order)
{
int n = values.Size();
int i, j;
@ -35,8 +35,8 @@ namespace netgen
}
void QuickSortRec (const Array<double> & values,
Array<int> & order,
void QuickSortRec (const NgArray<double> & values,
NgArray<int> & order,
int left, int right)
{
int i, j;
@ -62,8 +62,8 @@ namespace netgen
if (i < right) QuickSortRec (values, order, i, right);
}
void QuickSort (const Array<double> & values,
Array<int> & order)
void QuickSort (const NgArray<double> & values,
NgArray<int> & order)
{
int i, n = values.Size();
order.SetSize (n);

View File

@ -11,11 +11,11 @@ namespace netgen
{
// order(i) is sorted index of element i
extern void Sort (const Array<double> & values,
Array<int> & order);
extern void Sort (const NgArray<double> & values,
NgArray<int> & order);
extern void QuickSort (const Array<double> & values,
Array<int> & order);
extern void QuickSort (const NgArray<double> & values,
NgArray<int> & order);
@ -35,7 +35,7 @@ inline void BubbleSort (int size, T * data)
}
template <class T>
inline void BubbleSort (Array<T> & data)
inline void BubbleSort (NgArray<T> & data)
{
if(data.Size() > 0)
BubbleSort (data.Size(), &data[data.Begin()]);

View File

@ -41,7 +41,7 @@ public:
private:
///
Array<T> elems;
NgArray<T> elems;
///
INDEX size;
};

View File

@ -27,7 +27,7 @@ namespace netgen
oneblock = NULL;
}
BASE_TABLE :: BASE_TABLE (const FlatArray<int> & entrysizes, int elemsize)
BASE_TABLE :: BASE_TABLE (const NgFlatArray<int> & entrysizes, int elemsize)
: data(entrysizes.Size())
{
size_t cnt = 0;

View File

@ -29,7 +29,7 @@ protected:
};
///
Array<linestruct> data;
NgArray<linestruct> data;
char * oneblock;
public:
@ -42,7 +42,7 @@ public:
BASE_TABLE (int size);
///
BASE_TABLE (const FlatArray<int> & entrysizes, int elemsize);
BASE_TABLE (const NgFlatArray<int> & entrysizes, int elemsize);
///
~BASE_TABLE ();
@ -115,8 +115,8 @@ public:
inline TABLE (int size) : BASE_TABLE (size) { ; }
/// Creates fixed maximal element size table
inline TABLE (const FlatArray<int,BASE> & entrysizes)
: BASE_TABLE (FlatArray<int> (entrysizes.Size(), const_cast<int*>(&entrysizes[BASE])),
inline TABLE (const NgFlatArray<int,BASE> & entrysizes)
: BASE_TABLE (NgFlatArray<int> (entrysizes.Size(), const_cast<int*>(&entrysizes[BASE])),
sizeof(T))
{ ; }
@ -228,14 +228,14 @@ public:
}
/// Access entry.
FlatArray<T> operator[] (int i) const
NgFlatArray<T> operator[] (int i) const
{
#ifdef DEBUG
if (i-BASE < 0 || i-BASE >= data.Size())
cout << "table out of range, i = " << i << ", s = " << data.Size() << endl;
#endif
return FlatArray<T> (data[i-BASE].size, (T*)data[i-BASE].col);
return NgFlatArray<T> (data[i-BASE].size, (T*)data[i-BASE].col);
}
void DoArchive (Archive & ar)
@ -251,7 +251,7 @@ inline ostream & operator<< (ostream & ost, const TABLE<T,BASE> & table)
for (int i = BASE; i < table.Size()+BASE; i++)
{
ost << i << ": ";
FlatArray<T> row = table[i];
NgFlatArray<T> row = table[i];
ost << "(" << row.Size() << ") ";
for (int j = 0; j < row.Size(); j++)
ost << row[j] << " ";

View File

@ -14,14 +14,14 @@ namespace netgen
// double l,
MeshingParameters & mp, Mesh & mesh,
// double h, double h1, double h2, double hcurve,
double elto0, Array<double> & points)
double elto0, NgArray<double> & points)
{
double fperel, oldf, f;
int n = 10000;
Array<Point<2> > xi(n);
Array<double> hi(n);
NgArray<Point<2> > xi(n);
NgArray<double> hi(n);
for (int i = 0; i < n; i++)
{
@ -98,7 +98,7 @@ namespace netgen
int n = 100;
Point<2> mark, oldmark;
Array<double> curvepoints;
NgArray<double> curvepoints;
double edgelength, edgelengthold;
CalcPartition (spline, mp, mesh, elto0, curvepoints);
@ -111,7 +111,7 @@ namespace netgen
double lold = 0;
oldmark = pold;
edgelengthold = 0;
Array<int> locsearch;
NgArray<int> locsearch;
for (int i = 1; i <= n; i++)
{
@ -310,8 +310,8 @@ namespace netgen
{
// const int D = 2;
Array<int, PointIndex::BASE> mappoints (mesh.GetNP());
Array<double, PointIndex::BASE> param (mesh.GetNP());
NgArray<int, PointIndex::BASE> mappoints (mesh.GetNP());
NgArray<double, PointIndex::BASE> param (mesh.GetNP());
mappoints = -1;
param = 0;
@ -452,7 +452,7 @@ namespace netgen
for (int i = 1; i <= maxdomnr; i++)
mesh->AddFaceDescriptor (FaceDescriptor (i, 0, 0, i));
// set Array<string*> bcnames...
// set NgArray<string*> bcnames...
// number of bcnames
int maxsegmentindex = 0;
for (SegmentIndex si = 0; si < mesh->GetNSeg(); si++)
@ -478,8 +478,8 @@ namespace netgen
if (geometry.GetDomainTensorMeshing (domnr))
{ // tensor product mesh
Array<PointIndex, PointIndex::BASE> nextpi(bnp);
Array<int, PointIndex::BASE> si1(bnp), si2(bnp);
NgArray<PointIndex, PointIndex::BASE> nextpi(bnp);
NgArray<int, PointIndex::BASE> si1(bnp), si2(bnp);
PointIndex firstpi;
nextpi = -1;
@ -518,7 +518,7 @@ namespace netgen
Array<PointIndex> pts ( (nex+1) * (ney+1) ); // x ... inner loop
NgArray<PointIndex> pts ( (nex+1) * (ney+1) ); // x ... inner loop
pts = -1;
for (PointIndex pi = c1, i = 0; pi != c2; pi = nextpi[pi], i++)
@ -572,7 +572,7 @@ namespace netgen
Meshing2 meshing (mp, Box<3> (pmin, pmax));
Array<int, PointIndex::BASE> compress(bnp);
NgArray<int, PointIndex::BASE> compress(bnp);
compress = -1;
int cnt = 0;
for (PointIndex pi : BndPntRange)

View File

@ -187,7 +187,7 @@ namespace netgen
{
int npts;
infile >> npts;
Array< Point<D> > pts(npts);
NgArray< Point<D> > pts(npts);
for (int j = 0; j < npts; j++)
for(int k=0; k<D; k++)
infile >> pts[j](k);
@ -358,7 +358,7 @@ namespace netgen
{
int npts;
infile >> npts;
Array< Point<D> > pts(npts);
NgArray< Point<D> > pts(npts);
for (int j = 0; j < npts; j++)
for(int k=0; k<D; k++)
infile >> pts[j](k);
@ -489,8 +489,8 @@ namespace netgen
string keyword;
Array < GeomPoint<D> > infilepoints (0);
Array <int> pointnrs (0);
NgArray < GeomPoint<D> > infilepoints (0);
NgArray <int> pointnrs (0);
nump = 0;
int numdomains = 0;
@ -654,7 +654,7 @@ namespace netgen
{
int npts;
infile >> npts;
Array< Point<D> > pts(npts);
NgArray< Point<D> > pts(npts);
for (int j = 0; j < npts; j++)
for(int k=0; k<D; k++)
infile >> pts[j](k);
@ -666,7 +666,7 @@ namespace netgen
int npts,order;
infile >> npts;
infile >> order;
Array< Point<D> > pts(npts);
NgArray< Point<D> > pts(npts);
for (int j = 0; j < npts; j++)
for(int k=0; k<D; k++)
infile >> pts[j](k);
@ -830,7 +830,7 @@ namespace netgen
/*
void CalcPartition (const SplineSegExt & spline,
double l, double h, double h1, double h2,
double hcurve, double elto0, Array<double> & points)
double hcurve, double elto0, NgArray<double> & points)
{
double fperel, oldf, f;

View File

@ -94,7 +94,7 @@ namespace netgen
seg->GetCoeff (coeffs);
}
virtual void GetPoints (int n, Array<Point<2> > & points) const
virtual void GetPoints (int n, NgArray<Point<2> > & points) const
{
seg->GetPoints (n, points);
}
@ -131,12 +131,12 @@ namespace netgen
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
{
protected:
Array<char*> materials;
Array<double> maxh;
Array<bool> quadmeshing;
Array<bool> tensormeshing;
Array<int> layer;
Array<string*> bcnames;
NgArray<char*> materials;
NgArray<double> maxh;
NgArray<bool> quadmeshing;
NgArray<bool> tensormeshing;
NgArray<int> layer;
NgArray<string*> bcnames;
double elto0 = 1.0;

View File

@ -144,7 +144,7 @@ DLL_HEADER void ExportGeom2d(py::module &m)
int leftdomain, int rightdomain, py::object bc, double maxh)
{
int n = 1000;
Array<Point<2>> points;
NgArray<Point<2>> points;
for (int i = 0; i <= n; i++)
{
double t = double(i)/n;

View File

@ -85,13 +85,13 @@ public:
virtual void GetCoeff (Vector & coeffs) const = 0;
virtual void GetPoints (int n, Array<Point<2> > & points);
virtual void GetPoints (int n, NgArray<Point<2> > & points);
/** calculates lineintersections:
for lines $$ a x + b y + c = 0 $$ the interecting points are calculated
and stored in points */
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<2> > & points, const double eps) const
NgArray < Point<2> > & points, const double eps) const
{points.SetSize(0);}
virtual double MaxCurvature(void) const = 0;
@ -123,7 +123,7 @@ public:
virtual string GetType(void) const {return "line";}
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<2> > & points, const double eps) const;
NgArray < Point<2> > & points, const double eps) const;
virtual double MaxCurvature(void) const {return 0;}
};
@ -154,7 +154,7 @@ public:
const GeomPoint2d & TangentPoint (void) const { return p2; }
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<2> > & points, const double eps) const;
NgArray < Point<2> > & points, const double eps) const;
virtual double MaxCurvature(void) const;
};
@ -195,7 +195,7 @@ public:
virtual string GetType(void) const {return "circle";}
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<2> > & points, const double eps) const;
NgArray < Point<2> > & points, const double eps) const;
virtual double MaxCurvature(void) const {return 1./radius;}
};
@ -208,11 +208,11 @@ public:
///
class DiscretePointsSegment : public SplineSegment
{
Array<Point<2> > pts;
NgArray<Point<2> > pts;
GeomPoint2d p1, p2;
public:
///
DiscretePointsSegment (const Array<Point<2> > & apts);
DiscretePointsSegment (const NgArray<Point<2> > & apts);
///
virtual ~DiscretePointsSegment ();
///

View File

@ -52,7 +52,7 @@ namespace netgen
glColor3f (0, 0, 1);
Array<Point<2> > points, otherpoints;
NgArray<Point<2> > points, otherpoints;
for (int i = 1; i <= geometry2d->GetSplines().Size(); i++)
{

View File

@ -206,7 +206,7 @@ namespace netgen
}
void ADTree :: GetMatch (Array <int> & matches)
void ADTree :: GetMatch (NgArray <int> & matches)
{
int nodenr;
@ -398,10 +398,10 @@ namespace netgen
void ADTree3 :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode3*> stack(1000);
static Array<int> stackdir(1000);
static NgArray<ADTreeNode3*> stack(1000);
static NgArray<int> stackdir(1000);
ADTreeNode3 * node;
int dir, stacks;
@ -658,10 +658,10 @@ namespace netgen
void ADTree3Div :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode3Div*> stack(1000);
static Array<int> stackdir(1000);
static NgArray<ADTreeNode3Div*> stack(1000);
static NgArray<int> stackdir(1000);
ADTreeNode3Div * node;
int dir, i, stacks;
@ -917,10 +917,10 @@ namespace netgen
void ADTree3M :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode3M*> stack(1000);
static Array<int> stackdir(1000);
static NgArray<ADTreeNode3M*> stack(1000);
static NgArray<int> stackdir(1000);
ADTreeNode3M * node;
int dir, i, stacks;
@ -1163,9 +1163,9 @@ namespace netgen
void ADTree3F :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode3F*> stack(1000);
static NgArray<ADTreeNode3F*> stack(1000);
ADTreeNode3F * node;
int dir, i, stacks;
@ -1427,9 +1427,9 @@ namespace netgen
void ADTree3FM :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode3FM*> stack(1000);
static NgArray<ADTreeNode3FM*> stack(1000);
ADTreeNode3FM * node;
int dir, i, stacks;
@ -1700,11 +1700,11 @@ namespace netgen
void ADTree6 :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
// static Array<inttn6> stack(10000);
// static NgArray<inttn6> stack(10000);
// stack.SetSize (10000);
ArrayMem<inttn6,10000> stack(10000);
NgArrayMem<inttn6,10000> stack(10000);
pis.SetSize(0);
stack[0].node = root;
@ -1920,11 +1920,11 @@ namespace netgen
template <int dim, typename T>
void T_ADTree<dim,T> :: GetIntersecting (Point<dim> bmin, Point<dim> bmax,
Array<T> & pis) const
NgArray<T> & pis) const
{
// static Array<inttn6> stack(10000);
// static NgArray<inttn6> stack(10000);
// stack.SetSize (10000);
ArrayMem<inttn<dim,T>,10000> stack(10000);
NgArrayMem<inttn<dim,T>,10000> stack(10000);
pis.SetSize(0);
stack[0].node = root;
@ -2195,9 +2195,9 @@ namespace netgen
void ADTree6F :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
static Array<ADTreeNode6F*> stack(1000);
static NgArray<ADTreeNode6F*> stack(1000);
ADTreeNode6F * node;
int dir, i, stacks;
@ -2329,7 +2329,7 @@ namespace netgen
}
void Point3dTree :: GetIntersecting (const Point<3> & pmin, const Point<3> & pmax,
Array<int> & pis) const
NgArray<int> & pis) const
{
float pmi[3], pma[3];
for (int i = 0; i < 3; i++)
@ -2397,7 +2397,7 @@ namespace netgen
template <int dim, typename T>
void BoxTree<dim,T> ::GetIntersecting (const Point<dim> & pmin, const Point<dim> & pmax,
Array<T> & pis) const
NgArray<T> & pis) const
{
Point<2*dim> tpmin, tpmax;
double tol = Tolerance();

View File

@ -51,11 +51,11 @@ class ADTree
int dim;
ADTreeNode * root;
float *cmin, *cmax;
Array<ADTreeNode*> ela;
NgArray<ADTreeNode*> ela;
const ADTreeCriterion * criterion;
Array<ADTreeNode*> stack;
Array<int> stackdir;
NgArray<ADTreeNode*> stack;
NgArray<int> stackdir;
int stackindex;
public:
@ -65,11 +65,11 @@ public:
void Insert (const float * p, int pi);
// void GetIntersecting (const float * bmin, const float * bmax,
// Array<int> & pis) const;
// NgArray<int> & pis) const;
void SetCriterion (ADTreeCriterion & acriterion);
void Reset ();
int Next ();
void GetMatch (Array<int> & matches);
void GetMatch (NgArray<int> & matches);
void DeleteElement (int pi);
@ -105,7 +105,7 @@ class ADTree3
{
ADTreeNode3 * root;
float cmin[3], cmax[3];
Array<ADTreeNode3*> ela;
NgArray<ADTreeNode3*> ela;
public:
ADTree3 (const float * acmin,
@ -114,7 +114,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -155,7 +155,7 @@ class ADTree3Div
{
ADTreeNode3Div * root;
float cmin[3], cmax[3];
Array<ADTreeNode3Div*> ela;
NgArray<ADTreeNode3Div*> ela;
public:
ADTree3Div (const float * acmin,
@ -164,7 +164,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -204,7 +204,7 @@ class ADTree3M
{
ADTreeNode3M * root;
float cmin[3], cmax[3];
Array<ADTreeNode3M*> ela;
NgArray<ADTreeNode3M*> ela;
public:
ADTree3M (const float * acmin,
@ -213,7 +213,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -253,7 +253,7 @@ class ADTree3F
{
ADTreeNode3F * root;
float cmin[3], cmax[3];
Array<ADTreeNode3F*> ela;
NgArray<ADTreeNode3F*> ela;
public:
ADTree3F (const float * acmin,
@ -262,7 +262,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -300,7 +300,7 @@ class ADTree3FM
{
ADTreeNode3FM * root;
float cmin[3], cmax[3];
Array<ADTreeNode3FM*> ela;
NgArray<ADTreeNode3FM*> ela;
public:
ADTree3FM (const float * acmin,
@ -309,7 +309,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -351,7 +351,7 @@ class ADTree6
{
ADTreeNode6 * root;
float cmin[6], cmax[6];
Array<ADTreeNode6*> ela;
NgArray<ADTreeNode6*> ela;
public:
ADTree6 (const float * acmin,
@ -360,7 +360,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -443,7 +443,7 @@ public:
T_ADTreeNode<dim,T> * root;
// float cmin[dim], cmax[dim];
Point<dim> cmin, cmax;
// Array<T_ADTreeNode<dim>*> ela;
// NgArray<T_ADTreeNode<dim>*> ela;
ClosedHashTable<T, T_ADTreeNode<dim,T>*> ela;
public:
T_ADTree (Point<dim> acmin, Point<dim> acmax);
@ -451,7 +451,7 @@ public:
void Insert (Point<dim> p, T pi);
void GetIntersecting (Point<dim> bmin, Point<dim> bmax,
Array<T> & pis) const;
NgArray<T> & pis) const;
void DeleteElement (T pi);
@ -501,7 +501,7 @@ class ADTree6F
{
ADTreeNode6F * root;
float cmin[6], cmax[6];
Array<ADTreeNode6F*> ela;
NgArray<ADTreeNode6F*> ela;
public:
ADTree6F (const float * acmin,
@ -510,7 +510,7 @@ public:
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
void DeleteElement (int pi);
@ -547,7 +547,7 @@ public:
void DeleteElement (int pi)
{ tree->DeleteElement(pi); }
DLL_HEADER void GetIntersecting (const Point<3> & pmin, const Point<3> & pmax,
Array<int> & pis) const;
NgArray<int> & pis) const;
const ADTree3 & Tree() const { return *tree; };
};
@ -569,7 +569,7 @@ public:
void DeleteElement (T pi)
{ tree->DeleteElement(pi); }
void GetIntersecting (const Point<dim> & pmin, const Point<dim> & pmax,
Array<T> & pis) const;
NgArray<T> & pis) const;
double Tolerance() const { return 1e-7 * Dist(boxpmax, boxpmin); } // single precision
const auto & Tree() const { return *tree; };
auto & Tree() { return *tree; };

View File

@ -613,7 +613,7 @@ namespace netgen
class Polygon2d
{
protected:
Array<Point2d> points;
NgArray<Point2d> points;
public:
Polygon2d ();

View File

@ -711,8 +711,8 @@ void referencetransform :: ToPlain (const Point3d & p, Point3d & pp) const
pp.Z() = (ez_h * v);
}
void referencetransform :: ToPlain (const Array<Point3d> & p,
Array<Point3d> & pp) const
void referencetransform :: ToPlain (const NgArray<Point3d> & p,
NgArray<Point3d> & pp) const
{
Vec3d v;
int i;

View File

@ -735,7 +735,7 @@ namespace netgen
///
void ToPlain (const Point3d & p, Point3d & pp) const;
///
void ToPlain (const Array<Point3d> & p, Array<Point3d> & pp) const;
void ToPlain (const NgArray<Point3d> & p, NgArray<Point3d> & pp) const;
///
void FromPlain (const Point3d & pp, Point3d & p) const;
};

View File

@ -35,14 +35,14 @@ namespace netgen
template <>
void CircleSeg<3> :: LineIntersections (const double a, const double b, const double c,
Array < Point<3> > & points, const double eps) const
NgArray < Point<3> > & points, const double eps) const
{
cerr << "CircleSeg<3>::LineIntersections not implemented" << endl;
}
template <>
void CircleSeg<2> :: LineIntersections (const double a, const double b, const double c,
Array < Point<2> > & points, const double eps) const
NgArray < Point<2> > & points, const double eps) const
{
points.SetSize(0);
@ -62,7 +62,7 @@ namespace netgen
if(discr < 0)
return;
Array<double> t;
NgArray<double> t;
if(fabs(discr) < 1e-20)
t.Append(-0.5*c2/c1);
@ -488,7 +488,7 @@ namespace netgen
template<int D>
void SplineSeg3<D> :: LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const
NgArray < Point<D> > & points, const double eps) const
{
points.SetSize(0);
@ -535,7 +535,7 @@ namespace netgen
template < int D >
void SplineSeg3<D> :: GetRawData (Array<double> & data) const
void SplineSeg3<D> :: GetRawData (NgArray<double> & data) const
{
data.Append(3);
for(int i=0; i<D; i++)

View File

@ -94,13 +94,13 @@ namespace netgen
virtual void GetCoeff (Vector & coeffs) const = 0;
virtual void GetCoeff (Vector & coeffs, Point<D> p0) const { ; }
virtual void GetPoints (int n, Array<Point<D> > & points) const;
virtual void GetPoints (int n, NgArray<Point<D> > & points) const;
/** calculates (2D) lineintersections:
for lines $$ a x + b y + c = 0 $$ the interecting points are calculated
and stored in points */
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const
NgArray < Point<D> > & points, const double eps) const
{points.SetSize(0);}
// is the point in the convex hull (increased by eps) of the spline ?
@ -113,7 +113,7 @@ namespace netgen
virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const
{ cerr << "Project not implemented for spline base-class" << endl;}
virtual void GetRawData (Array<double> & data) const
virtual void GetRawData (NgArray<double> & data) const
{ cerr << "GetRawData not implemented for spline base-class" << endl;}
};
@ -157,7 +157,7 @@ namespace netgen
virtual string GetType(void) const {return "line";}
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const;
NgArray < Point<D> > & points, const double eps) const;
virtual bool InConvexHull (Point<D> p, double eps) const
{
@ -168,7 +168,7 @@ namespace netgen
virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const;
virtual void GetRawData (Array<double> & data) const;
virtual void GetRawData (NgArray<double> & data) const;
};
@ -214,7 +214,7 @@ namespace netgen
const GeomPoint<D> & TangentPoint (void) const { return p2; }
DLL_HEADER virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const;
NgArray < Point<D> > & points, const double eps) const;
virtual bool InConvexHull (Point<D> p, double eps) const
{
@ -225,7 +225,7 @@ namespace netgen
DLL_HEADER virtual void Project (const Point<D> point, Point<D> & point_on_curve, double & t) const;
DLL_HEADER virtual void GetRawData (Array<double> & data) const;
DLL_HEADER virtual void GetRawData (NgArray<double> & data) const;
};
@ -271,7 +271,7 @@ namespace netgen
virtual string GetType(void) const {return "circle";}
virtual void LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const;
NgArray < Point<D> > & points, const double eps) const;
virtual bool InConvexHull (Point<D> p, double eps) const
{
@ -290,11 +290,11 @@ namespace netgen
template<int D>
class DiscretePointsSeg : public SplineSeg<D>
{
Array<Point<D> > pts;
NgArray<Point<D> > pts;
GeomPoint<D> p1n, p2n;
public:
///
DiscretePointsSeg (const Array<Point<D> > & apts);
DiscretePointsSeg (const NgArray<Point<D> > & apts);
// default constructor for archive
DiscretePointsSeg() {}
virtual void DoArchive(Archive& ar)
@ -346,7 +346,7 @@ namespace netgen
template<int D>
void SplineSeg<D> :: GetPoints (int n, Array<Point<D> > & points) const
void SplineSeg<D> :: GetPoints (int n, NgArray<Point<D> > & points) const
{
points.SetSize (n);
if (n >= 2)
@ -445,7 +445,7 @@ namespace netgen
template<int D>
void LineSeg<D> :: LineIntersections (const double a, const double b, const double c,
Array < Point<D> > & points, const double eps) const
NgArray < Point<D> > & points, const double eps) const
{
points.SetSize(0);
@ -478,7 +478,7 @@ namespace netgen
template<int D>
void LineSeg<D> :: GetRawData (Array<double> & data) const
void LineSeg<D> :: GetRawData (NgArray<double> & data) const
{
data.Append(2);
for(int i=0; i<D; i++)
@ -599,7 +599,7 @@ namespace netgen
template<int D>
DiscretePointsSeg<D> :: DiscretePointsSeg (const Array<Point<D> > & apts)
DiscretePointsSeg<D> :: DiscretePointsSeg (const NgArray<Point<D> > & apts)
: pts (apts)
{
for(int i=0; i<D; i++)
@ -647,13 +647,13 @@ namespace netgen
template<int D, int ORDER>
class BSplineSeg : public SplineSeg<D>
{
Array<Point<D> > pts;
NgArray<Point<D> > pts;
GeomPoint<D> p1n, p2n;
Array<int> ti;
NgArray<int> ti;
public:
///
BSplineSeg (const Array<Point<D> > & apts);
BSplineSeg (const NgArray<Point<D> > & apts);
///
//default constructor for archive
BSplineSeg() {}
@ -680,7 +680,7 @@ namespace netgen
// Constructor
template<int D,int ORDER>
BSplineSeg<D,ORDER> :: BSplineSeg (const Array<Point<D> > & apts)
BSplineSeg<D,ORDER> :: BSplineSeg (const NgArray<Point<D> > & apts)
: pts (apts)
{
/*

View File

@ -23,7 +23,7 @@ namespace netgen
template<int D>
void SplineGeometry<D> :: GetRawData (Array<double> & raw_data) const
void SplineGeometry<D> :: GetRawData (NgArray<double> & raw_data) const
{
raw_data.Append(D);
// raw_data.Append(elto0);
@ -36,7 +36,7 @@ namespace netgen
template<int D>
int SplineGeometry<D> :: Load (const Array<double> & raw_data, const int startpos)
int SplineGeometry<D> :: Load (const NgArray<double> & raw_data, const int startpos)
{
int pos = startpos;
if(raw_data[pos] != D)
@ -49,7 +49,7 @@ namespace netgen
splines.SetSize(int(raw_data[pos]));
pos++;
Array< Point<D> > pts(3);
NgArray< Point<D> > pts(3);
for(int i=0; i<splines.Size(); i++)
{
@ -99,7 +99,7 @@ namespace netgen
return;
}
Array<Point<D> > points;
NgArray<Point<D> > points;
for (int i = 0; i < splines.Size(); i++)
{
splines[i]->GetPoints (20, points);

View File

@ -26,23 +26,23 @@ namespace netgen
{
// protected:
public:
Array < GeomPoint<D> > geompoints;
Array < SplineSeg<D>* > splines;
NgArray < GeomPoint<D> > geompoints;
NgArray < SplineSeg<D>* > splines;
SplineGeometry() : geompoints{}, splines{} { ; }
DLL_HEADER ~SplineGeometry();
DLL_HEADER int Load (const Array<double> & raw_data, const int startpos = 0);
DLL_HEADER int Load (const NgArray<double> & raw_data, const int startpos = 0);
virtual void DoArchive(Archive& ar)
{
ar & geompoints & splines;
}
DLL_HEADER void GetRawData (Array<double> & raw_data) const;
DLL_HEADER void GetRawData (NgArray<double> & raw_data) const;
const Array<SplineSeg<D>*> & GetSplines () const
const NgArray<SplineSeg<D>*> & GetSplines () const
{ return splines; }
int GetNSplines (void) const { return splines.Size(); }

View File

@ -250,33 +250,33 @@ template <> NGX_INLINE DLL_HEADER const Ng_Node<0> Ngx_Mesh :: GetNode<0> (int v
{
case 3:
{
FlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr);
NgFlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr);
node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0];
FlatArray<SurfaceElementIndex> bia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
NgFlatArray<SurfaceElementIndex> bia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
node.bnd_elements.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0];
break;
}
case 2:
{
FlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
NgFlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0];
FlatArray<SegmentIndex> bia = mesh->GetTopology().GetVertexSegments(vnr);
NgFlatArray<SegmentIndex> bia = mesh->GetTopology().GetVertexSegments(vnr);
node.bnd_elements.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0];
break;
}
case 1:
{
FlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr);
NgFlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr);
node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0];
FlatArray<int> bia = mesh->GetTopology().GetVertexPointElements(vnr);
NgFlatArray<int> bia = mesh->GetTopology().GetVertexPointElements(vnr);
node.bnd_elements.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0];
break;
@ -306,7 +306,7 @@ template <> NGX_INLINE DLL_HEADER const Ng_Node<2> Ngx_Mesh :: GetNode<2> (int n
NGX_INLINE DLL_HEADER Ng_Buffer<int[2]> Ngx_Mesh :: GetPeriodicVertices(int idnr) const
{
Array<INDEX_2> apairs;
NgArray<INDEX_2> apairs;
mesh->GetIdentifications().GetPairs (idnr+1, apairs);
for(auto& ind : apairs)
{

View File

@ -58,8 +58,8 @@ namespace netgen
#ifdef SOCKETS
extern AutoPtr<ClientSocket> clientsocket;
//extern Array< AutoPtr < ServerInfo > > servers;
extern Array< ServerInfo* > servers;
//extern NgArray< AutoPtr < ServerInfo > > servers;
extern NgArray< ServerInfo* > servers;
#endif
@ -141,7 +141,7 @@ void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm)
}
istream * infile;
Array<char> buf; // for distributing geometry!
NgArray<char> buf; // for distributing geometry!
int strs;
if( id == 0) {
@ -191,9 +191,9 @@ void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm)
bool endfile = false;
int n, dummy;
Array<int> segment_weights;
Array<int> surface_weights;
Array<int> volume_weights;
NgArray<int> segment_weights;
NgArray<int> surface_weights;
NgArray<int> volume_weights;
while (weightsfile.good() && !endfile)
{
@ -479,14 +479,14 @@ const char * Ng_GetDomainMaterial (int dom)
int Ng_GetUserDataSize (char * id)
{
Array<double> da;
NgArray<double> da;
mesh->GetUserData (id, da);
return da.Size();
}
void Ng_GetUserData (char * id, double * data)
{
Array<double> da;
NgArray<double> da;
mesh->GetUserData (id, da);
for (int i = 0; i < da.Size(); i++)
data[i] = da[i];
@ -640,12 +640,12 @@ int Ng_FindElementOfPoint (double * p, double * lami, int build_searchtree,
const int * const indices, const int numind)
{
Array<int> * dummy(NULL);
NgArray<int> * dummy(NULL);
int ind = -1;
if(indices != NULL)
{
dummy = new Array<int>(numind);
dummy = new NgArray<int>(numind);
for(int i=0; i<numind; i++) (*dummy)[i] = indices[i];
}
@ -686,12 +686,12 @@ int Ng_FindSurfaceElementOfPoint (double * p, double * lami, int build_searchtre
const int * const indices, const int numind)
{
Array<int> * dummy(NULL);
NgArray<int> * dummy(NULL);
int ind = -1;
if(indices != NULL)
{
dummy = new Array<int>(numind);
dummy = new NgArray<int>(numind);
for(int i=0; i<numind; i++) (*dummy)[i] = indices[i];
}
@ -1550,7 +1550,7 @@ int Ng_GetSurfaceElement_Edges (int elnr, int * edges, int * orient)
/*
int i, ned;
const MeshTopology & topology = mesh->GetTopology();
Array<int> ia;
NgArray<int> ia;
topology.GetSurfaceElementEdges (elnr, ia);
ned = ia.Size();
for (i = 1; i <= ned; i++)
@ -1581,7 +1581,7 @@ int Ng_GetSurfaceElement_Face (int selnr, int * orient)
int Ng_GetFace_Vertices (int fnr, int * vert)
{
const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia;
NgArrayMem<int,4> ia;
topology.GetFaceVertices (fnr, ia);
for (int i = 0; i < ia.Size(); i++)
vert[i] = ia[i];
@ -1593,7 +1593,7 @@ int Ng_GetFace_Vertices (int fnr, int * vert)
int Ng_GetFace_Edges (int fnr, int * edge)
{
const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia;
NgArrayMem<int,4> ia;
topology.GetFaceEdges (fnr, ia);
for (int i = 0; i < ia.Size(); i++)
edge[i] = ia[i];
@ -1638,19 +1638,19 @@ void Ng_GetVertexElements (int vnr, int * els)
{
case 3:
{
FlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr);
NgFlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr);
for (int i = 0; i < ia.Size(); i++) els[i] = ia[i]+1;
break;
}
case 2:
{
FlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
NgFlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
for (int i = 0; i < ia.Size(); i++) els[i] = ia[i]+1;
break;
}
case 1:
{
FlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr);
NgFlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr);
for (int i = 0; i < ia.Size(); i++) els[i] = ia[i]+1;
break;
/*
@ -1800,7 +1800,7 @@ int Ng_GetClusterRepElement (int pi)
int Ng_GetNPeriodicVertices (int idnr)
{
Array<INDEX_2> apairs;
NgArray<INDEX_2> apairs;
mesh->GetIdentifications().GetPairs (idnr, apairs);
return apairs.Size();
}
@ -1809,7 +1809,7 @@ int Ng_GetNPeriodicVertices (int idnr)
// pairs should be an integer array of 2*npairs
void Ng_GetPeriodicVertices (int idnr, int * pairs)
{
Array<INDEX_2> apairs;
NgArray<INDEX_2> apairs;
mesh->GetIdentifications().GetPairs (idnr, apairs);
for (int i = 0; i < apairs.Size(); i++)
{
@ -1823,7 +1823,7 @@ void Ng_GetPeriodicVertices (int idnr, int * pairs)
int Ng_GetNPeriodicEdges (int idnr)
{
Array<int,PointIndex::BASE> map;
NgArray<int,PointIndex::BASE> map;
//const MeshTopology & top = mesh->GetTopology();
int nse = mesh->GetNSeg();
@ -1850,7 +1850,7 @@ int Ng_GetNPeriodicEdges (int idnr)
void Ng_GetPeriodicEdges (int idnr, int * pairs)
{
Array<int,PointIndex::BASE> map;
NgArray<int,PointIndex::BASE> map;
const MeshTopology & top = mesh->GetTopology();
int nse = mesh->GetNSeg();
@ -1928,7 +1928,7 @@ int Ng_IsRunning()
int Ng_GetVertex_Elements( int vnr, int* elems )
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<ElementIndex,4> indexArray;
NgArrayMem<ElementIndex,4> indexArray;
topology.GetVertexElements( vnr, indexArray );
for( int i=0; i<indexArray.Size(); i++ )
@ -1945,7 +1945,7 @@ int Ng_GetVertex_SurfaceElements( int vnr, int* elems )
case 3:
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<SurfaceElementIndex,4> indexArray;
NgArrayMem<SurfaceElementIndex,4> indexArray;
topology.GetVertexSurfaceElements( vnr, indexArray );
for( int i=0; i<indexArray.Size(); i++ )
@ -1977,7 +1977,7 @@ int Ng_GetVertex_SurfaceElements( int vnr, int* elems )
int Ng_GetVertex_NElements( int vnr )
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<ElementIndex,4> indexArray;
NgArrayMem<ElementIndex,4> indexArray;
topology.GetVertexElements( vnr, indexArray );
return indexArray.Size();
@ -1991,7 +1991,7 @@ int Ng_GetVertex_NSurfaceElements( int vnr )
case 3:
{
const MeshTopology& topology = mesh->GetTopology();
ArrayMem<SurfaceElementIndex,4> indexArray;
NgArrayMem<SurfaceElementIndex,4> indexArray;
topology.GetVertexSurfaceElements( vnr, indexArray );
return indexArray.Size();
}
@ -2157,9 +2157,9 @@ int Ng_Bisect_WithInfo ( const char * refinementfile, double ** qualityloss, int
mesh->LocalHFunction().SetGrading (mparam.grading);
Array<double> * qualityloss_arr = NULL;
NgArray<double> * qualityloss_arr = NULL;
if(qualityloss != NULL)
qualityloss_arr = new Array<double>;
qualityloss_arr = new NgArray<double>;
ref -> Bisect (*mesh, biopt, qualityloss_arr);

View File

@ -756,7 +756,7 @@ namespace netgen
Ng_BufferMS<int,4> Ngx_Mesh::GetFaceEdges (int fnr) const
{
const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia;
NgArrayMem<int,4> ia;
topology.GetFaceEdges (fnr+1, ia);
Ng_BufferMS<int,4> res(ia.Size());
for (size_t i = 0; i < ia.Size(); i++)
@ -1070,7 +1070,7 @@ namespace netgen
int * const indices, int numind) const
{
Array<int> dummy(numind);
NgArray<int> dummy(numind);
for (int i = 0; i < numind; i++) dummy[i] = indices[i]+1;
double lam3[3];
@ -1111,7 +1111,7 @@ namespace netgen
int * const indices, int numind) const
{
Array<int> dummy(numind);
NgArray<int> dummy(numind);
for (int i = 0; i < numind; i++) dummy[i] = indices[i]+1;
Point<3> p3d(p[0], p[1], p[2]);
@ -1291,17 +1291,17 @@ void Ngx_Mesh::SetSurfaceElementOrders (int enr, int ox, int oy)
{
case 0:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantPNums(locnum);
NgFlatArray<int> dn = mesh->GetParallelTopology().GetDistantPNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
case 1:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantEdgeNums(locnum);
NgFlatArray<int> dn = mesh->GetParallelTopology().GetDistantEdgeNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
case 2:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantFaceNums(locnum);
NgFlatArray<int> dn = mesh->GetParallelTopology().GetDistantFaceNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
default:

View File

@ -53,7 +53,7 @@ namespace netgen
string name;
string placement;
string valuetype;
Array<double> places;
NgArray<double> places;
};
@ -188,7 +188,7 @@ namespace netgen
else if (token == "MATERIALS")
{
*testout << "parse materials" << endl;
Array<double> young_modulus, poisson_ratio, mass_density;
NgArray<double> young_modulus, poisson_ratio, mass_density;
while (1)
{
@ -264,7 +264,7 @@ namespace netgen
string propid;
sbuf >> elnr >> def >> ch;
sbuf >> typid >> matid >> propid;
Array<int> pnums;
NgArray<int> pnums;
while (1)
{
int pn;
@ -305,7 +305,7 @@ namespace netgen
sbuf >> nr >> kw >> ch;
if (kw == "NODES")
{
Array<int> enums;
NgArray<int> enums;
while (1)
{
int en;
@ -329,7 +329,7 @@ namespace netgen
sbuf >> nr >> kw >> ch;
if (kw == "FACES")
{
Array<int> fnums;
NgArray<int> fnums;
while (1)
{
int fn;
@ -375,7 +375,7 @@ namespace netgen
else if (token == "LOADS")
{
Array<LoadType*> loadtypes;
NgArray<LoadType*> loadtypes;
while (1)
{

View File

@ -49,17 +49,17 @@ namespace netgen
Point3d p;
int numObj3D,numObj2D,numObj1D,numObj0D;
// bool nullstarted;
Array<int> eldom;
NgArray<int> eldom;
int minId3D = -1, minId2D = -1;
int maxId3D(-1), maxId2D(-1), maxId1D(-1), maxId0D(-1);
Array<Array<int> *> segmentdata;
Array<Element2d* > tris;
NgArray<NgArray<int> *> segmentdata;
NgArray<Element2d* > tris;
Array<int> userdata_int; // just save data for 1:1 output
Array<double> userdata_double;
Array<int> point_pids;
Array<int> tetfacedata;
Array<int> uid_to_group_3D, uid_to_group_2D, uid_to_group_1D, uid_to_group_0D;
NgArray<int> userdata_int; // just save data for 1:1 output
NgArray<double> userdata_double;
NgArray<int> point_pids;
NgArray<int> tetfacedata;
NgArray<int> uid_to_group_3D, uid_to_group_2D, uid_to_group_1D, uid_to_group_0D;
while(!done)
{
@ -226,7 +226,7 @@ namespace netgen
segmentdata.SetSize(nedges);
for(int i=0; i<nedges; i++)
{
segmentdata[i] = new Array<int>(7);
segmentdata[i] = new NgArray<int>(7);
*segmentdata[i] = -1;
in >> dummyint;
in >> (*segmentdata[i])[0] >> (*segmentdata[i])[1];
@ -350,8 +350,8 @@ namespace netgen
for(int i=0; i<nperiodicmasterfaces; i++)
{
int tri1,tri2,transl;
Array<PointIndex> nodes1(3),nodes2(3);
Array<double> sortval1(3),sortval2(3);
NgArray<PointIndex> nodes1(3),nodes2(3);
NgArray<double> sortval1(3),sortval2(3);
in >> tri1 >> tri2 >> transl;
if(transl > maxtransl)
@ -455,7 +455,7 @@ namespace netgen
cout << endl;
// Array<int> indextodescriptor(maxId2D+1);
// NgArray<int> indextodescriptor(maxId2D+1);
// for(int i=1; i<=mesh.GetNFD(); i++)
// indextodescriptor[mesh.GetFaceDescriptor(i).SurfNr()] = i;
@ -538,7 +538,7 @@ namespace netgen
case 27:
// Object2D GroupID, #Faces <immediately followed by> FaceID List
{
Array<int> ports;
NgArray<int> ports;
//int totnum = 0;
uid_to_group_2D.SetSize(maxId2D+1);
uid_to_group_2D = -1;
@ -665,7 +665,7 @@ namespace netgen
mesh.SetUserData("TETmesh:uid_to_group_0D",uid_to_group_0D);
Array<SurfaceElementIndex> surfindices(tris.Size());
NgArray<SurfaceElementIndex> surfindices(tris.Size());
surfindices = -1;
for(int i=0; i<tris.Size(); i++)
@ -740,7 +740,7 @@ namespace netgen
}
// Array<int> indextodescriptor(maxId2D+1);
// NgArray<int> indextodescriptor(maxId2D+1);
// for(int i=1; i<=mesh.GetNFD(); i++)
// indextodescriptor[mesh.GetFaceDescriptor(i).SurfNr()] = i;

View File

@ -99,7 +99,7 @@ namespace netgen
// map from unv element nr to our element number + an index if it is vol (0), bnd(1), ...
std::map<size_t, std::tuple<size_t, int>> element_map;
Array<Segment> tmp_segments;
NgArray<Segment> tmp_segments;
while (in.good())
{
in >> reco;
@ -449,7 +449,7 @@ namespace netgen
int bcprop;
ifstream inpkt (pktfile.c_str());
inpkt >> np;
Array<double> values(np);
NgArray<double> values(np);
for (i = 1; i <= np; i++)
{
Point3d p(0,0,0);

View File

@ -39,11 +39,11 @@ namespace netgen
// Global arrays used to maintain the owner, neighbour and face lists
// so that they are accessible across functions
static Array<int> owner_facelist;
static Array<int> owner_celllist;
static Array<int> neighbour_celllist;
static Array<int> surfelem_bclist;
static Array<INDEX_2> surfelem_lists;
static NgArray<int> owner_facelist;
static NgArray<int> owner_celllist;
static NgArray<int> neighbour_celllist;
static NgArray<int> surfelem_bclist;
static NgArray<INDEX_2> surfelem_lists;
@ -118,17 +118,17 @@ namespace netgen
// Initialise arrays to zero if required
neighbour_celllist = 0;
// Array used to keep track of Faces which have already been
// NgArray used to keep track of Faces which have already been
// processed and added to the Owner list... In addition, also the
// location where the face appears in the Owner list is also stored
// to speed up creation of the Neighbour list
Array<int> ownerfaces(totfaces);
NgArray<int> ownerfaces(totfaces);
ownerfaces = 0;
// Array to hold the set of local faces of each volume element
// NgArray to hold the set of local faces of each volume element
// while running through the set of volume elements
// NOTE: The size is set automatically by the Netgen topology function
Array<int> locfaces;
NgArray<int> locfaces;
// Secondary indices used to independently advance the owner
// and boundary condition arrays within the main loop
@ -383,9 +383,9 @@ namespace netgen
*outfile << "(\n";
// Array to hold the indices of the points of each face to
// NgArray to hold the indices of the points of each face to
// flip if required
Array<int> facepnts;
NgArray<int> facepnts;
// Write the faces in the order specified in the owners lists of the
// internal cells and the boundary cells
@ -545,7 +545,7 @@ namespace netgen
*outfile << "\n";
Array<INDEX_3> bcarray;
NgArray<INDEX_3> bcarray;
int ind = 1;
// Since the boundary conditions are already sorted in ascending

View File

@ -139,7 +139,7 @@ void WriteAbaqusFormat (const Mesh & mesh,
int masternode(0);
Array<INDEX_2> pairs;
NgArray<INDEX_2> pairs;
BitArray master(np), help(np);
master.Set();
for (i = 1; i <= 3; i++)
@ -158,7 +158,7 @@ void WriteAbaqusFormat (const Mesh & mesh,
cout << "masternode = " << masternode << " = "
<< mesh.Point(masternode) << endl;
Array<int> slaves(3);
NgArray<int> slaves(3);
for (i = 1; i <= 3; i++)
{
mesh.GetIdentifications().GetPairs (i, pairs);

View File

@ -39,8 +39,8 @@ void WriteDiffPackFormat (const Mesh & mesh,
int np = mesh.GetNP();
int ne = mesh.GetNE();
int nse = mesh.GetNSE();
Array <int> BIname;
Array <int> BCsinpoint;
NgArray <int> BIname;
NgArray <int> BCsinpoint;
int i, j, k, l;
@ -112,7 +112,7 @@ void WriteDiffPackFormat (const Mesh & mesh,
/*
for (j = 1; j <= nse; j++)
*/
FlatArray<SurfaceElementIndex> sels = point2sel[i];
NgFlatArray<SurfaceElementIndex> sels = point2sel[i];
for (int jj = 0; jj < sels.Size(); jj++)
{
for (k = 1; k <= mesh[sels[jj]].GetNP(); k++)
@ -203,8 +203,8 @@ void WriteDiffPackFormat (const Mesh & mesh,
int np = mesh.GetNP();
//int ne = mesh.GetNE();
int nse = mesh.GetNSE();
Array <int> BIname;
Array <int> BCsinpoint;
NgArray <int> BIname;
NgArray <int> BCsinpoint;
int i, j, k, l;

View File

@ -65,9 +65,9 @@ void WriteFluentFormat (const Mesh & mesh,
Element2d face, face2;
int i2, j2;
Array<INDEX_3> surfaceelp;
Array<int> surfaceeli;
Array<int> locels;
NgArray<INDEX_3> surfaceelp;
NgArray<int> surfaceeli;
NgArray<int> locels;
//no cells=no tets
//no faces=2*tets

View File

@ -33,7 +33,7 @@ void WriteJCMFormat (const Mesh & mesh,
int np = mesh.GetNP();
// Identic points
Array<int,PointIndex::BASE> identmap1, identmap2, identmap3;
NgArray<int,PointIndex::BASE> identmap1, identmap2, identmap3;
mesh.GetIdentifications().GetMap(1, identmap1);
mesh.GetIdentifications().GetMap(2, identmap2);
mesh.GetIdentifications().GetMap(3, identmap3);
@ -95,7 +95,7 @@ void WriteJCMFormat (const Mesh & mesh,
int nbquad = 0;
// array with 1 if point on any tetra, 0 else
// this is needed in order to arrange the prism points in the right order
Array<int,1> pointsOnTetras;
NgArray<int,1> pointsOnTetras;
pointsOnTetras.SetSize (mesh.GetNP());
pointsOnTetras = 0;
for (i = 1; i <= ne; i++)

View File

@ -27,7 +27,7 @@ void WriteTecPlotFormat (const Mesh & mesh,
INDEX ne = mesh.GetNE();
INDEX nse = mesh.GetNSE();
Array<int> sn(np);
NgArray<int> sn(np);
ofstream outfile(filename.c_str());
outfile << "TITLE=\" " << filename << "\"" << endl;

View File

@ -23,16 +23,16 @@ namespace netgen
cout << "starting .tet export to file " << filename << endl;
Array<int> point_ids,edge_ids,face_ids;
Array<int> elnum(mesh.GetNE());
NgArray<int> point_ids,edge_ids,face_ids;
NgArray<int> elnum(mesh.GetNE());
elnum = -1;
Array<int> userdata_int;
Array<double> userdata_double;
Array<int> ports;
NgArray<int> userdata_int;
NgArray<double> userdata_double;
NgArray<int> ports;
Array<int> uid_to_group_3D, uid_to_group_2D, uid_to_group_1D, uid_to_group_0D;
NgArray<int> uid_to_group_3D, uid_to_group_2D, uid_to_group_1D, uid_to_group_0D;
int pos_int = 0;
int pos_double = 0;
@ -98,9 +98,9 @@ namespace netgen
INDEX_2_CLOSED_HASHTABLE<int> edgenumbers(6*mesh.GetNE()+3*mesh.GetNSE());;
INDEX_3_CLOSED_HASHTABLE<int> facenumbers(4*mesh.GetNE()+mesh.GetNSE());
Array<INDEX_2> edge2node;
Array<INDEX_3> face2edge;
Array<INDEX_4> element2face;
NgArray<INDEX_2> edge2node;
NgArray<INDEX_3> face2edge;
NgArray<INDEX_4> element2face;
int numelems(0),numfaces(0),numedges(0),numnodes(0);
@ -285,7 +285,7 @@ namespace netgen
int numObj0D,numObj1D,numObj2D,numObj3D;
int numports = ports.Size();
Array<int> nodenum(point_ids.Size()+1);
NgArray<int> nodenum(point_ids.Size()+1);
nodenum = -1;
@ -367,18 +367,18 @@ namespace netgen
uidpid = "UID";
Array< Array<int,PointIndex::BASE>* > idmaps;
NgArray< NgArray<int,PointIndex::BASE>* > idmaps;
for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++)
{
if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC)
{
idmaps.Append(new Array<int,PointIndex::BASE>);
idmaps.Append(new NgArray<int,PointIndex::BASE>);
mesh.GetIdentifications().GetMap(i,*idmaps.Last(),true);
}
}
Array<int> id_num,id_type;
Array< Array<int> *> id_groups;
NgArray<int> id_num,id_type;
NgArray< NgArray<int> *> id_groups;
// sst 2008-03-12: Write problem class...
@ -449,7 +449,7 @@ namespace netgen
if(nodenum[i] == -1)
continue;
Array<int> group;
NgArray<int> group;
group.Append(i);
for(int j=0; j<idmaps.Size(); j++)
{
@ -466,7 +466,7 @@ namespace netgen
}
if(group.Size() > 1)
{
id_groups.Append(new Array<int>(group));
id_groups.Append(new NgArray<int>(group));
if(group.Size() == 2)
{
id_type[i] = 1;
@ -590,18 +590,18 @@ namespace netgen
Array< Array<int>* > vertex_to_edge(mesh.GetNP()+1);
NgArray< NgArray<int>* > vertex_to_edge(mesh.GetNP()+1);
for(int i=0; i<=mesh.GetNP(); i++)
vertex_to_edge[i] = new Array<int>;
vertex_to_edge[i] = new NgArray<int>;
Array< Array<int,PointIndex::BASE>* > idmaps_edge(idmaps.Size());
NgArray< NgArray<int,PointIndex::BASE>* > idmaps_edge(idmaps.Size());
for(int i=0; i<idmaps_edge.Size(); i++)
{
idmaps_edge[i] = new Array<int,PointIndex::BASE>(numedges);
idmaps_edge[i] = new NgArray<int,PointIndex::BASE>(numedges);
(*idmaps_edge[i]) = 0;
}
Array<int> possible;
NgArray<int> possible;
for(int i=0; i<edge2node.Size(); i++)
{
const INDEX_2 & v = edge2node[i];
@ -649,7 +649,7 @@ namespace netgen
continue;
Array<int> group;
NgArray<int> group;
group.Append(i);
for(int j=0; j<idmaps_edge.Size(); j++)
{
@ -667,7 +667,7 @@ namespace netgen
if(group.Size() > 1)
{
id_num[i] = 1;
id_groups.Append(new Array<int>(group));
id_groups.Append(new NgArray<int>(group));
if(group.Size() == 2)
{
id_type[i] = 1;
@ -701,7 +701,7 @@ namespace netgen
continue;
Array<int> group;
NgArray<int> group;
group.Append(i);
for(int j=0; j<idmaps_edge.Size(); j++)
{
@ -719,7 +719,7 @@ namespace netgen
if(group.Size() > 1)
{
id_num[i] = 1;
id_groups.Append(new Array<int>(group));
id_groups.Append(new NgArray<int>(group));
if(group.Size() == 2)
{
id_type[i] = 1;
@ -805,9 +805,9 @@ namespace netgen
Array< Array<int>* > edge_to_face(numedges+1);
NgArray< NgArray<int>* > edge_to_face(numedges+1);
for(int i=0; i<edge_to_face.Size(); i++)
edge_to_face[i] = new Array<int>;
edge_to_face[i] = new NgArray<int>;
for(int i=0; i<idmaps.Size(); i++)
@ -864,7 +864,7 @@ namespace netgen
if(id_num[i] != 0)
continue;
Array<int> group;
NgArray<int> group;
group.Append(i);
for(int j=0; j<idmaps.Size(); j++)
{
@ -882,7 +882,7 @@ namespace netgen
if(group.Size() > 1)
{
id_num[i] = -1;
id_groups.Append(new Array<int>(group));
id_groups.Append(new NgArray<int>(group));
if(group.Size() == 2)
n2++;
else
@ -981,7 +981,7 @@ namespace netgen
<< endl;
Array< Array<int> * > groups;
NgArray< NgArray<int> * > groups;
int maxg = -1;
for(int i = 0; i<uid_to_group_3D.Size(); i++)
@ -999,7 +999,7 @@ namespace netgen
groups.SetSize(maxg+1);
for(int i=0; i<groups.Size(); i++)
groups[i] = new Array<int>;
groups[i] = new NgArray<int>;
for(ElementIndex i=0; i<mesh.GetNE(); i++)
if(uid_to_group_3D[mesh[i].GetIndex()] >= 0)

View File

@ -18,8 +18,8 @@ namespace netgen
extern MeshingParameters mparam;
void RegisterUserFormats (Array<const char*> & names,
Array<const char*> & extensions)
void RegisterUserFormats (NgArray<const char*> & names,
NgArray<const char*> & extensions)
{
const char *types[] =
@ -392,7 +392,7 @@ void WriteSTLExtFormat (const Mesh & mesh,
int numBCs = 0;
Array<int> faceBCs;
NgArray<int> faceBCs;
TABLE<int> faceBCMapping;
faceBCs.SetSize(mesh.GetNFD());
@ -427,7 +427,7 @@ void WriteSTLExtFormat (const Mesh & mesh,
for(int faceNr = 1;faceNr <= faceBCMapping.EntrySize(bcInd); faceNr++)
{
Array<SurfaceElementIndex> faceSei;
NgArray<SurfaceElementIndex> faceSei;
mesh.GetSurfaceElementsOfFace(faceBCMapping.Get(bcInd,faceNr),faceSei);
for (int i = 0; i < faceSei.Size(); i++)
@ -778,7 +778,7 @@ void WriteEdgeElementFormat (const Mesh & mesh,
int inverttets = mparam.inverttets;
int invertsurf = mparam.inverttrigs;
Array<int> edges;
NgArray<int> edges;
ofstream outfile (filename.c_str());
@ -935,7 +935,7 @@ void WriteFile (int typ,
INDEX_2_HASHTABLE<int> edgeht(mesh.GetNP());
// list of edges
Array<INDEX_2> edgelist;
NgArray<INDEX_2> edgelist;
// edge (point) on boundary ?
BitArray bedge, bpoint(mesh.GetNP());

View File

@ -154,8 +154,8 @@ void WriteDolfinFormat (const Mesh & mesh,
const string & filename);
extern void DLL_HEADER RegisterUserFormats (Array<const char*> & names,
Array<const char*> & extensions);
extern void DLL_HEADER RegisterUserFormats (NgArray<const char*> & names,
NgArray<const char*> & extensions);
extern bool DLL_HEADER WriteUserFormat (const string & format,

View File

@ -54,12 +54,12 @@ namespace netgen
int p1, p2;
};
static Array<POINT3D> points;
static Array<VOLELEMENT> volelements;
static Array<SURFELEMENT> surfelements;
static NgArray<POINT3D> points;
static NgArray<VOLELEMENT> volelements;
static NgArray<SURFELEMENT> surfelements;
static Array<FACE> faces;
static Array<EDGE> edges;
static NgArray<FACE> faces;
static NgArray<EDGE> edges;
void ReadFile (char * filename)

View File

@ -427,7 +427,7 @@ namespace netgen
double max, hr;
Array<int> p(n); // pivot-permutation
NgArray<int> p(n); // pivot-permutation
Vector hv(n);
@ -1154,7 +1154,7 @@ namespace netgen
}
void DenseMatrix :: MultElementMatrix (const Array<int> & pnum,
void DenseMatrix :: MultElementMatrix (const NgArray<int> & pnum,
const Vector & hx, Vector & hy)
{
int i, j;
@ -1180,7 +1180,7 @@ namespace netgen
}
void DenseMatrix :: MultTransElementMatrix (const Array<int> & pnum,
void DenseMatrix :: MultTransElementMatrix (const NgArray<int> & pnum,
const Vector & hx, Vector & hy)
{
int i, j;

View File

@ -23,7 +23,7 @@ endif(APPLE)
target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen )
target_link_libraries( mesh PRIVATE ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY})
target_link_libraries( mesh PRIVATE netgen_metis ${ZLIB_LIBRARIES} ${PYTHON_LIBRARIES} )
if(NOT WIN32)
install( TARGETS mesh ${NG_INSTALL_DIR})
endif(NOT WIN32)

Some files were not shown because too many files have changed in this diff Show More