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 # we are linking to object libraries on Windows
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
else(WIN32) else(WIN32)
cmake_minimum_required(VERSION 3.1.3) cmake_minimum_required(VERSION 3.8)
endif(WIN32) endif(WIN32)
if(NOT WIN32) if(NOT WIN32)
@ -115,6 +115,7 @@ endif (ADDITIONAL_PATHS)
####################################################################### #######################################################################
# build options # build options
include_directories ("${PROJECT_SOURCE_DIR}/include") include_directories ("${PROJECT_SOURCE_DIR}/include")
include_directories ("${PROJECT_SOURCE_DIR}/libsrc")
include_directories ("${PROJECT_SOURCE_DIR}/libsrc/include") include_directories ("${PROJECT_SOURCE_DIR}/libsrc/include")
include_directories ("${PROJECT_BINARY_DIR}") 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) get_filename_component(lib_name ${lib} name)
endmacro() endmacro()
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17)
if(WIN32) if(WIN32)
get_WIN32_WINNT(ver) get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX) add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX)
@ -287,13 +288,20 @@ if (USE_PYTHON)
endif (USE_PYTHON) endif (USE_PYTHON)
####################################################################### #######################################################################
add_library(netgen_mpi INTERFACE)
add_library(netgen_metis INTERFACE)
if (USE_MPI) if (USE_MPI)
find_package(MPI REQUIRED) 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) find_package(METIS REQUIRED)
add_definitions(-DPARALLEL -DMETIS) target_include_directories(netgen_metis INTERFACE ${METIS_INCLUDE_DIR})
include_directories(${MPI_CXX_INCLUDE_PATH}) target_link_libraries(netgen_metis INTERFACE ${METIS_LIBRARY} )
include_directories(${METIS_INCLUDE_DIR}) target_compile_definitions(netgen_metis INTERFACE METIS )
endif (USE_MPI) endif (USE_MPI)
install(TARGETS netgen_mpi netgen_metis ${NG_INSTALL_DIR})
####################################################################### #######################################################################
if (USE_OCC) 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) target_compile_definitions(ngcore PRIVATE NGCORE_EXPORTS)
if(NOT WIN32) if(NOT WIN32)
@ -31,9 +39,11 @@ if(USE_PYTHON)
target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS}) target_include_directories(ngcore PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES}) target_link_libraries(ngcore PRIVATE ${PYTHON_LIBRARIES})
endif(USE_PYTHON) 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 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 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) DESTINATION ${NG_INSTALL_DIR_INCLUDE}/core COMPONENT netgen_devel)
if(ENABLE_CPP_CORE_GUIDELINES_CHECK) 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> #include <mpi.h>
#endif #endif
#include "exception.hpp"
namespace ngcore namespace ngcore
{ {
@ -191,7 +192,7 @@ namespace ngcore
}; };
#else #else // PARALLEL
class MPI_Comm { class MPI_Comm {
int nr; int nr;
public: public:
@ -240,7 +241,7 @@ namespace ngcore
void Bcast (T & s, int root = 0) const { ; } 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 #define NETGEN_CORE_NGCORE_HPP
#include "archive.hpp" #include "archive.hpp"
#include "array.hpp"
#include "exception.hpp" #include "exception.hpp"
#include "localheap.hpp"
#include "logging.hpp" #include "logging.hpp"
#include "mpi_wrapper.hpp"
#include "profiler.hpp" #include "profiler.hpp"
#include "symboltable.hpp" #include "symboltable.hpp"
#include "taskmanager.hpp"
#include "version.hpp" #include "version.hpp"
#include "mpi_wrapper.hpp"
#endif // NETGEN_CORE_NGCORE_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; ost << "\n" << val.first << ": " << val.second;
return ost; 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 } // namespace ngcore
#endif // NETGEN_CORE_UTILS_HPP #endif // NETGEN_CORE_UTILS_HPP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,8 +10,8 @@
namespace netgen namespace netgen
{ {
Array<SpecialPoint> specpoints; NgArray<SpecialPoint> specpoints;
static Array<MeshPoint> spoints; static NgArray<MeshPoint> spoints;
#define TCL_OK 0 #define TCL_OK 0
#define TCL_ERROR 1 #define TCL_ERROR 1
@ -140,7 +140,7 @@ namespace netgen
} }
} }
Array<int> loc; NgArray<int> loc;
if (!ec.point_on_edge_problem) if (!ec.point_on_edge_problem)
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++) for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{ {
@ -234,17 +234,17 @@ namespace netgen
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Surface meshing"; multithread.task = "Surface meshing";
Array<Segment> segments; NgArray<Segment> segments;
int noldp = mesh.GetNP(); int noldp = mesh.GetNP();
double starttime = GetTime(); double starttime = GetTime();
// find master faces from identified // find master faces from identified
Array<int> masterface(mesh.GetNFD()); NgArray<int> masterface(mesh.GetNFD());
for (int i = 1; i <= mesh.GetNFD(); i++) for (int i = 1; i <= mesh.GetNFD(); i++)
masterface.Elem(i) = i; masterface.Elem(i) = i;
Array<INDEX_2> fpairs; NgArray<INDEX_2> fpairs;
bool changed; bool changed;
do do
{ {
@ -382,7 +382,7 @@ namespace netgen
for (int j = 0; j < geom.singfaces.Size(); j++) for (int j = 0; j < geom.singfaces.Size(); j++)
{ {
Array<int> surfs; NgArray<int> surfs;
geom.GetIndependentSurfaceIndices (geom.singfaces[j]->GetSolid(), geom.GetIndependentSurfaceIndices (geom.singfaces[j]->GetSolid(),
geom.BoundingBox(), surfs); geom.BoundingBox(), surfs);
for (int k = 1; k <= mesh.GetNFD(); k++) for (int k = 1; k <= mesh.GetNFD(); k++)
@ -680,7 +680,7 @@ namespace netgen
mesh->SetGlobalH (mparam.maxh); mesh->SetGlobalH (mparam.maxh);
mesh->SetMinimalH (mparam.minh); mesh->SetMinimalH (mparam.minh);
Array<double> maxhdom(geom.GetNTopLevelObjects()); NgArray<double> maxhdom(geom.GetNTopLevelObjects());
for (int i = 0; i < maxhdom.Size(); i++) for (int i = 0; i < maxhdom.Size(); i++)
maxhdom[i] = geom.GetTopLevelObject(i)->GetMaxH(); 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 :: void Identification ::
BuildSurfaceElements (Array<Segment> & segs, BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf) Mesh & mesh, const Surface * surf)
{ {
cout << "Identification::BuildSurfaceElements called for base-class" << endl; cout << "Identification::BuildSurfaceElements called for base-class" << endl;
@ -93,14 +93,14 @@ BuildSurfaceElements (Array<Segment> & segs,
void Identification :: void Identification ::
BuildVolumeElements (Array<class Element2d> & surfels, BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh) class Mesh & mesh)
{ {
; ;
} }
void Identification :: void Identification ::
GetIdentifiedFaces (Array<INDEX_2> & idfaces) const GetIdentifiedFaces (NgArray<INDEX_2> & idfaces) const
{ {
idfaces.SetSize(0); idfaces.SetSize(0);
for (int i = 1; i <= identfaces.GetNBags(); i++) for (int i = 1; i <= identfaces.GetNBags(); i++)
@ -136,7 +136,7 @@ PeriodicIdentification :: ~PeriodicIdentification ()
/* /*
void PeriodicIdentification :: IdentifySpecialPoints void PeriodicIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points) (NgArray<class SpecialPoint> & points)
{ {
int i, j; int i, j;
int bestj; int bestj;
@ -446,7 +446,7 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
void PeriodicIdentification :: void PeriodicIdentification ::
BuildSurfaceElements (Array<Segment> & segs, BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf) Mesh & mesh, const Surface * surf)
{ {
int found = 0; int found = 0;
@ -458,7 +458,7 @@ BuildSurfaceElements (Array<Segment> & segs,
if (geom.GetSurface(surfnr) == s1 || if (geom.GetSurface(surfnr) == s1 ||
geom.GetSurface(surfnr) == s2) geom.GetSurface(surfnr) == s2)
{ {
Array<int> copy_points; NgArray<int> copy_points;
for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++) for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++)
{ {
@ -609,7 +609,7 @@ void CloseSurfaceIdentification :: GetData (ostream & ost) const
/* /*
void CloseSurfaceIdentification :: IdentifySpecialPoints void CloseSurfaceIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points) (NgArray<class SpecialPoint> & points)
{ {
int i, j; int i, j;
int bestj; int bestj;
@ -677,7 +677,7 @@ Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
if (!dom_surf_valid) if (!dom_surf_valid)
{ {
const_cast<bool&> (dom_surf_valid) = 1; 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) if (domain)
{ {
@ -887,7 +887,7 @@ GetIdentifiedPoint (class Mesh & mesh, int pi)
const Surface *snew; const Surface *snew;
const Point<3> & p = mesh.Point (pi); 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); mesh.GetIdentifications().GetMap (nr, identmap);
if (identmap.Get(pi)) if (identmap.Get(pi))
return identmap.Get(pi); return identmap.Get(pi);
@ -958,13 +958,13 @@ void CloseSurfaceIdentification :: IdentifyPoints (Mesh & mesh)
{ {
int np = mesh.GetNP(); int np = mesh.GetNP();
Array<int> points_on_surf2; NgArray<int> points_on_surf2;
for (int i2 = 1; i2 <= np; i2++) for (int i2 = 1; i2 <= np; i2++)
if (s2->PointOnSurface (mesh.Point(i2))) if (s2->PointOnSurface (mesh.Point(i2)))
points_on_surf2.Append (i2); points_on_surf2.Append (i2);
Array<int> surfs_of_p1; NgArray<int> surfs_of_p1;
for (int i1 = 1; i1 <= np; i1++) for (int i1 = 1; i1 <= np; i1++)
{ {
@ -1080,7 +1080,7 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
s2rep = geom.GetSurfaceClassRepresentant(i); s2rep = geom.GetSurfaceClassRepresentant(i);
} }
Array<int> segs_on_face1, segs_on_face2; NgArray<int> segs_on_face1, segs_on_face2;
identfaces.DeleteData(); identfaces.DeleteData();
@ -1219,13 +1219,13 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
void CloseSurfaceIdentification :: void CloseSurfaceIdentification ::
BuildSurfaceElements (Array<Segment> & segs, BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf) Mesh & mesh, const Surface * surf)
{ {
bool found = 0; bool found = 0;
int cntquads = 0; int cntquads = 0;
Array<int,PointIndex::BASE> identmap; NgArray<int,PointIndex::BASE> identmap;
identmap = 0; identmap = 0;
mesh.GetIdentifications().GetMap (nr, identmap); mesh.GetIdentifications().GetMap (nr, identmap);
@ -1240,7 +1240,7 @@ BuildSurfaceElements (Array<Segment> & segs,
//(*testout) << "segs = " << endl << segs << endl; //(*testout) << "segs = " << endl << segs << endl;
//(*testout) << "identmap = " << endl << identmap << endl; //(*testout) << "identmap = " << endl << identmap << endl;
//Array<bool> foundseg(segs.Size()); //NgArray<bool> foundseg(segs.Size());
//foundseg = false; //foundseg = false;
// insert quad layer: // insert quad layer:
@ -1301,7 +1301,7 @@ BuildSurfaceElements (Array<Segment> & segs,
{ {
PrintMessage(3, "insert quad layer of ", cntquads, PrintMessage(3, "insert quad layer of ", cntquads,
" elements at face ", segs.Get(1).si); " elements at face ", segs.Get(1).si);
//Array<Segment> aux; //NgArray<Segment> aux;
//for(int i=0; i<segs.Size();i++) //for(int i=0; i<segs.Size();i++)
// if(!foundseg[i]) // if(!foundseg[i])
// aux.Append(segs[i]); // aux.Append(segs[i]);
@ -1319,7 +1319,7 @@ BuildSurfaceElements (Array<Segment> & segs,
void CloseSurfaceIdentification :: void CloseSurfaceIdentification ::
BuildSurfaceElements2 (Array<Segment> & segs, BuildSurfaceElements2 (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf) Mesh & mesh, const Surface * surf)
{ {
// copy mesh // copy mesh
@ -1420,7 +1420,7 @@ BuildSurfaceElements2 (Array<Segment> & segs,
void CloseSurfaceIdentification :: void CloseSurfaceIdentification ::
BuildVolumeElements (Array<class Element2d> & surfels, BuildVolumeElements (NgArray<class Element2d> & surfels,
class Mesh & mesh) class Mesh & mesh)
{ {
; ;
@ -1481,7 +1481,7 @@ void CloseEdgesIdentification :: GetData (ostream & ost) const
/* /*
void CloseEdgesIdentification :: IdentifySpecialPoints void CloseEdgesIdentification :: IdentifySpecialPoints
(Array<class SpecialPoint> & points) (NgArray<class SpecialPoint> & points)
{ {
int i, j; int i, j;
int bestj; int bestj;
@ -1633,7 +1633,7 @@ void CloseEdgesIdentification :: IdentifyPoints (Mesh & mesh)
} }
void CloseEdgesIdentification :: void CloseEdgesIdentification ::
BuildSurfaceElements (Array<Segment> & segs, BuildSurfaceElements (NgArray<Segment> & segs,
Mesh & mesh, const Surface * surf) Mesh & mesh, const Surface * surf)
{ {
int found = 0; int found = 0;

View File

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

View File

@ -7,7 +7,7 @@ namespace netgen
{ {
Polyhedra::Face::Face (int pi1, int pi2, int pi3, Polyhedra::Face::Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points, const NgArray<Point<3> > & points,
int ainputnr) int ainputnr)
{ {
inputnr = ainputnr; inputnr = ainputnr;
@ -165,7 +165,7 @@ INSOLID_TYPE Polyhedra :: PointInSolid (const Point<3> & p,
void Polyhedra :: GetTangentialSurfaceIndices (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++) for (int i = 0; i < faces.Size(); i++)
{ {
@ -192,7 +192,7 @@ INSOLID_TYPE Polyhedra :: VecInSolid (const Point<3> & p,
const Vec<3> & v, const Vec<3> & v,
double eps) const double eps) const
{ {
Array<int> point_on_faces; NgArray<int> point_on_faces;
INSOLID_TYPE res(DOES_INTERSECT); INSOLID_TYPE res(DOES_INTERSECT);
Vec<3> vn = v; 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, 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; Vec<3> v1n = v1;
v1n.Normalize(); v1n.Normalize();
@ -447,7 +447,7 @@ void Polyhedra :: GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec
void Polyhedra :: GetPrimitiveData (const char *& classname, void Polyhedra :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const NgArray<double> & coeffs) const
{ {
classname = "Polyhedra"; classname = "Polyhedra";
coeffs.SetSize(0); 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; int maxnum = -1;
@ -602,14 +602,14 @@ void Polyhedra :: GetPolySurfs(Array < Array<int> * > & polysurfs)
polysurfs.SetSize(maxnum+1); polysurfs.SetSize(maxnum+1);
for(int i=0; i<polysurfs.Size(); i++) 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++) for(int i = 0; i<faces.Size(); i++)
polysurfs[faces[i].inputnr]->Append(faces[i].planenr); 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++) for (int i = 0; i < points.Size(); i++)
pts.Append (points[i]); pts.Append (points[i]);
@ -617,7 +617,7 @@ void Polyhedra::CalcSpecialPoints (Array<Point<3> > & pts) const
void Polyhedra :: AnalyzeSpecialPoint (const Point<3> & /* pt */, 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 () { ; }
Face (int pi1, int pi2, int pi3, Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points, const NgArray<Point<3> > & points,
int ainputnr); int ainputnr);
}; };
Array<Point<3> > points; NgArray<Point<3> > points;
Array<Face> faces; NgArray<Face> faces;
Array<Plane*> planes; NgArray<Plane*> planes;
Box<3> poly_bbox; Box<3> poly_bbox;
double eps_base1; double eps_base1;
@ -65,15 +65,15 @@ namespace netgen
double eps) const; double eps) const;
virtual void GetTangentialSurfaceIndices (const Point<3> & p, 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, 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, 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 Vec<3> SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const;
virtual int GetNSurfaces() const virtual int GetNSurfaces() const
@ -83,8 +83,8 @@ namespace netgen
virtual const Surface & GetSurface (int i) const virtual const Surface & GetSurface (int i) const
{ return *planes[i]; } { return *planes[i]; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const; virtual void GetPrimitiveData (const char *& classname, NgArray<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs); virtual void SetPrimitiveData (NgArray<double> & coeffs);
virtual void Reduce (const BoxSphere<3> & box); virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce (); virtual void UnReduce ();
@ -92,7 +92,7 @@ namespace netgen
int AddPoint (const Point<3> & p); int AddPoint (const Point<3> & p);
int AddFace (int pi1, int pi2, int pi3, int inputnum); int AddFace (int pi1, int pi2, int pi3, int inputnum);
void GetPolySurfs(Array < Array<int> * > & polysurfs); void GetPolySurfs(NgArray < NgArray<int> * > & polysurfs);
protected: protected:
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const; 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) .def("__init__", FunctionPointer ([](SplineSurface* instance, shared_ptr<SPSolid> base, py::list cuts)
{ {
auto primitive = dynamic_cast<OneSurfacePrimitive*> (base->GetSolid()->GetPrimitive()); 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++) for(int i = 0; i<py::len(cuts);i++)
{ {
py::extract<shared_ptr<SPSolid>> sps(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<int>(val).check()) mod_nr = py::extract<int> (val)();
if (py::extract<string>(val).check()) bcname = new string ( py::extract<string> (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); mod_solid -> GetSolid() -> GetSurfaceIndices (si);
// cout << "change bc on surfaces: " << si << " to " << mod_nr << endl; // 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) -> SetBCProp(surf->GetBase()->GetBCProperty());
self.GetTopLevelObject(tlonr) -> SetBCName(surf->GetBase()->GetBCName()); self.GetTopLevelObject(tlonr) -> SetBCName(surf->GetBase()->GetBCName());
self.GetTopLevelObject(tlonr) -> SetMaxH(surf->GetBase()->GetMaxH()); self.GetTopLevelObject(tlonr) -> SetMaxH(surf->GetBase()->GetMaxH());
Array<Point<3>> non_midpoints; NgArray<Point<3>> non_midpoints;
for(auto spline : surf->GetSplines()) for(auto spline : surf->GetSplines())
{ {
non_midpoints.Append(spline->GetPoint(0)); 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 .def("CloseSurfaces", FunctionPointer
([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2, py::list aslices ) ([] (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); s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2); s2->GetSolid()->GetSurfaceIndices (si2);
cout << "surface ids1 = " << si1 << endl; cout << "surface ids1 = " << si1 << endl;
@ -505,7 +505,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
try try
{ {
int n = py::len(aslices); int n = py::len(aslices);
Array<double> slices(n); NgArray<double> slices(n);
for(int i=0; i<n; i++) for(int i=0; i<n; i++)
{ {
slices[i]= py::extract<double>(aslices[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, ([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2,
int reflevels, shared_ptr<SPSolid> domain_solid) int reflevels, shared_ptr<SPSolid> domain_solid)
{ {
Array<int> si1, si2; NgArray<int> si1, si2;
s1->GetSolid()->GetSurfaceIndices (si1); s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2); s2->GetSolid()->GetSurfaceIndices (si2);
cout << "surface ids1 = " << si1 << endl; 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, ([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2,
Transformation<3> trafo) Transformation<3> trafo)
{ {
Array<int> si1, si2; NgArray<int> si1, si2;
s1->GetSolid()->GetSurfaceIndices (si1); s1->GetSolid()->GetSurfaceIndices (si1);
s2->GetSolid()->GetSurfaceIndices (si2); s2->GetSolid()->GetSurfaceIndices (si2);
cout << "identify surfaces " << si1[0] << " and " << si2[0] << endl; 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; deletable = true;
int pos = 0; int pos = 0;
Array< Point<2> > p(3); NgArray< Point<2> > p(3);
int stype = int(raw_data[pos]); pos++; int stype = int(raw_data[pos]); pos++;
@ -333,7 +333,7 @@ namespace netgen
{ {
double retval = spline->MaxCurvature(); double retval = spline->MaxCurvature();
Array < Point<2> > checkpoints; NgArray < Point<2> > checkpoints;
const SplineSeg3<2> * ss3 = dynamic_cast<const SplineSeg3<2> *>(spline); const SplineSeg3<2> * ss3 = dynamic_cast<const SplineSeg3<2> *>(spline);
const LineSeg<2> * ls = dynamic_cast<const LineSeg<2> *>(spline); const LineSeg<2> * ls = dynamic_cast<const LineSeg<2> *>(spline);
@ -386,7 +386,7 @@ namespace netgen
// find smallest y value of spline: // find smallest y value of spline:
Array<double> testt; NgArray<double> testt;
if(!isfirst) if(!isfirst)
testt.Append(0); 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(); data.DeleteAll();
spline->GetRawData(data); spline->GetRawData(data);
@ -718,7 +718,7 @@ namespace netgen
return DOES_INTERSECT; return DOES_INTERSECT;
else else
{ {
Array < Point<3> > pext(2); NgArray < Point<3> > pext(2);
Point<3> p; Point<3> p;
pext[0] = box.PMin(); pext[0] = box.PMin();
@ -772,7 +772,7 @@ namespace netgen
const double b = -randomx; const double b = -randomx;
const double c = -a*p2d(0)-b*p2d(1); const double c = -a*p2d(0)-b*p2d(1);
Array < Point<2> > points; NgArray < Point<2> > points;
//(*testout) << "face intersections at: " << endl; //(*testout) << "face intersections at: " << endl;
for(int i=0; i<faces.Size(); i++) for(int i=0; i<faces.Size(); i++)
@ -803,7 +803,7 @@ namespace netgen
} }
void Revolution :: GetTangentialSurfaceIndices (const Point<3> & p, 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++) for (int j = 0; j < faces.Size(); j++)
if (faces[j] -> PointInFace(p, eps)) if (faces[j] -> PointInFace(p, eps))
@ -823,7 +823,7 @@ namespace netgen
return pInSolid; return pInSolid;
} }
Array<int> intersecting_faces; NgArray<int> intersecting_faces;
for(int i=0; i<faces.Size(); i++) for(int i=0; i<faces.Size(); i++)
if(faces[i]->PointInFace(p,eps)) // == DOES_INTERSECT) if(faces[i]->PointInFace(p,eps)) // == DOES_INTERSECT)

View File

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

View File

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

View File

@ -29,8 +29,8 @@ namespace netgen
int domnr; int domnr;
const Solid *sol; const Solid *sol;
double factor; double factor;
// Array<Point<3> > points; // NgArray<Point<3> > points;
// Array<INDEX_2> segms; // NgArray<INDEX_2> segms;
public: public:
SingularFace (int adomnr, const Solid * asol, double sf) SingularFace (int adomnr, const Solid * asol, double sf)
: domnr(adomnr), sol(asol), factor(sf) { ; } : domnr(adomnr), sol(asol), factor(sf) { ; }
@ -47,8 +47,8 @@ namespace netgen
int domnr; int domnr;
const CSGeometry& geom; const CSGeometry& geom;
const Solid *sol1, *sol2; const Solid *sol1, *sol2;
Array<Point<3> > points; NgArray<Point<3> > points;
Array<INDEX_2> segms; NgArray<INDEX_2> segms;
double factor; double factor;
double maxhinit; double maxhinit;
@ -68,7 +68,7 @@ namespace netgen
public: public:
double beta; double beta;
const Solid *sol1, *sol2, *sol3; const Solid *sol1, *sol2, *sol3;
Array<Point<3> > points; NgArray<Point<3> > points;
double factor; double factor;
public: 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; int in, strin;
bounds.SetSize (0); bounds.SetSize (0);
RecBoundaries (p, bounds, in, strin); 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 int & in, int & strin) const
{ {
switch (op) switch (op)
@ -585,7 +585,7 @@ namespace netgen
case SECTION: case SECTION:
{ {
int i, in1, in2, strin1, strin2; int i, in1, in2, strin1, strin2;
Array<int> bounds1, bounds2; NgArray<int> bounds1, bounds2;
s1 -> RecBoundaries (p, bounds1, in1, strin1); s1 -> RecBoundaries (p, bounds1, in1, strin1);
s2 -> RecBoundaries (p, bounds2, in2, strin2); s2 -> RecBoundaries (p, bounds2, in2, strin2);
@ -604,7 +604,7 @@ namespace netgen
case UNION: case UNION:
{ {
int i, in1, in2, strin1, strin2; int i, in1, in2, strin1, strin2;
Array<int> bounds1, bounds2; NgArray<int> bounds1, bounds2;
s1 -> RecBoundaries (p, bounds1, in1, strin1); s1 -> RecBoundaries (p, bounds1, in1, strin1);
s2 -> RecBoundaries (p, bounds2, in2, strin2); 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; int in, strin;
RecTangentialSolid (p, tansol, surfids, in, strin, eps); 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 int & in, int & strin, double eps) const
{ {
tansol = NULL; tansol = NULL;
@ -742,7 +742,7 @@ namespace netgen
void Solid :: TangentialSolid2 (const Point<3> & p, void Solid :: TangentialSolid2 (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t,
Solid *& tansol, Array<int> & surfids, double eps) const Solid *& tansol, NgArray<int> & surfids, double eps) const
{ {
int in, strin; int in, strin;
surfids.SetSize (0); surfids.SetSize (0);
@ -752,7 +752,7 @@ namespace netgen
} }
void Solid :: RecTangentialSolid2 (const Point<3> & p, const Vec<3> & t, 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 int & in, int & strin, double eps) const
{ {
tansol = NULL; tansol = NULL;
@ -856,7 +856,7 @@ namespace netgen
void Solid :: TangentialSolid3 (const Point<3> & p, void Solid :: TangentialSolid3 (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, const Vec<3> & t, const Vec<3> & t2,
Solid *& tansol, Array<int> & surfids, Solid *& tansol, NgArray<int> & surfids,
double eps) const double eps) const
{ {
int in, strin; int in, strin;
@ -869,7 +869,7 @@ namespace netgen
void Solid :: RecTangentialSolid3 (const Point<3> & p, void Solid :: RecTangentialSolid3 (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, 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 int & in, int & strin, double eps) const
{ {
tansol = NULL; tansol = NULL;
@ -967,7 +967,7 @@ namespace netgen
void Solid :: TangentialEdgeSolid (const Point<3> & p, void Solid :: TangentialEdgeSolid (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, const Vec<3> & m, 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 double eps) const
{ {
int in, strin; int in, strin;
@ -982,7 +982,7 @@ namespace netgen
void Solid :: RecTangentialEdgeSolid (const Point<3> & p, void Solid :: RecTangentialEdgeSolid (const Point<3> & p,
const Vec<3> & t, const Vec<3> & t2, const Vec<3> & m, 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 int & in, int & strin, double eps) const
{ {
tansol = NULL; tansol = NULL;
@ -1450,13 +1450,13 @@ namespace netgen
return 0; return 0;
} }
void Solid :: GetSurfaceIndices (Array<int> & surfind) const void Solid :: GetSurfaceIndices (NgArray<int> & surfind) const
{ {
surfind.SetSize (0); surfind.SetSize (0);
RecGetSurfaceIndices (surfind); RecGetSurfaceIndices (surfind);
} }
void Solid :: RecGetSurfaceIndices (Array<int> & surfind) const void Solid :: RecGetSurfaceIndices (NgArray<int> & surfind) const
{ {
switch (op) 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); surfind.SetSize (0);
RecGetTangentialSurfaceIndices (p, surfind, eps); 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) switch (op)
{ {
@ -1576,14 +1576,14 @@ namespace netgen
void Solid :: GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, 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); surfind.SetSize (0);
RecGetTangentialSurfaceIndices2 (p, v, surfind, eps); RecGetTangentialSurfaceIndices2 (p, v, surfind, eps);
} }
void Solid :: RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, 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) switch (op)
{ {
@ -1628,14 +1628,14 @@ namespace netgen
void Solid :: GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, 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); surfind.SetSize (0);
RecGetTangentialSurfaceIndices3 (p, v, v2, surfind, eps); RecGetTangentialSurfaceIndices3 (p, v, v2, surfind, eps);
} }
void Solid :: RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, 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) 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, 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) 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 (); 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) switch (op)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,16 +7,16 @@ namespace netgen
class SplineSurface : public OneSurfacePrimitive class SplineSurface : public OneSurfacePrimitive
{ {
protected: protected:
Array<GeomPoint<3>> geompoints; NgArray<GeomPoint<3>> geompoints;
Array<shared_ptr<SplineSeg<3>>> splines; NgArray<shared_ptr<SplineSeg<3>>> splines;
Array<string> bcnames; NgArray<string> bcnames;
Array<double> maxh; NgArray<double> maxh;
shared_ptr<OneSurfacePrimitive> baseprimitive; shared_ptr<OneSurfacePrimitive> baseprimitive;
shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> cuts; shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> cuts;
shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> all_cuts; shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> all_cuts;
public: 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) OneSurfacePrimitive(), baseprimitive(abaseprimitive), cuts(acuts)
{ ; } { ; }
// default constructor for archive // default constructor for archive
@ -25,7 +25,7 @@ namespace netgen
const auto & GetSplines() const { return splines; } const auto & GetSplines() const { return splines; }
int GetNSplines() const { return splines.Size(); } 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(); } string GetSplineType(const int i) const { return splines[i]->GetType(); }
SplineSeg<3> & GetSpline(const int i) { return *splines[i]; } SplineSeg<3> & GetSpline(const int i) { return *splines[i]; }
const SplineSeg<3> & GetSpline(const int i) const { 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); 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); void AppendSegment(shared_ptr<SplineSeg<3>> spline, string & bcname, double amaxh = -1);
const shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> CreateCuttingSurfaces(); const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> CreateCuttingSurfaces();
const shared_ptr<Array<shared_ptr<OneSurfacePrimitive>>> GetCuts() const { return all_cuts; } const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> GetCuts() const { return all_cuts; }
const shared_ptr<OneSurfacePrimitive> GetBase() const { return baseprimitive; } const shared_ptr<OneSurfacePrimitive> GetBase() const { return baseprimitive; }
virtual void Project (Point<3> & p3d) const { baseprimitive->Project(p3d); } virtual void Project (Point<3> & p3d) const { baseprimitive->Project(p3d); }
@ -50,7 +50,7 @@ namespace netgen
{ return baseprimitive->HesseNorm(); } { return baseprimitive->HesseNorm(); }
virtual Point<3> GetSurfacePoint () const virtual Point<3> GetSurfacePoint () const
{ return baseprimitive->GetSurfacePoint(); } { return baseprimitive->GetSurfacePoint(); }
virtual void CalcSpecialPoints(Array<Point<3>> & pts) const virtual void CalcSpecialPoints(NgArray<Point<3>> & pts) const
{ baseprimitive->CalcSpecialPoints(pts); } { baseprimitive->CalcSpecialPoints(pts); }
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const 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 void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual double HesseNorm () const; virtual double HesseNorm () const;
virtual Point<3> GetSurfacePoint () 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; 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, void Primitive :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const NgArray<double> & coeffs) const
{ {
classname = "undef"; classname = "undef";
coeffs.SetSize (0); 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, 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++) for (int j = 0; j < GetNSurfaces(); j++)
if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps) if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps)
@ -288,7 +288,7 @@ void Primitive :: GetTangentialSurfaceIndices (const Point<3> & p,
void Primitive :: void Primitive ::
GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v, 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; cout << "get tangvecsurfind not implemented" << endl;
surfind.SetSize (0); surfind.SetSize (0);
@ -296,7 +296,7 @@ GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
void Primitive :: void Primitive ::
GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2, 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++) for (int j = 0; j < GetNSurfaces(); j++)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,14 +2,14 @@ add_definitions(-DNGINTERFACE_EXPORTS)
add_library(gen INTERFACE) add_library(gen INTERFACE)
set(sdir ${CMAKE_CURRENT_SOURCE_DIR}) set(sdir ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(gen INTERFACE 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}/hashtabl.cpp ${sdir}/mystring.cpp ${sdir}/optmem.cpp ${sdir}/parthreads.cpp
${sdir}/seti.cpp ${sdir}/sort.cpp ${sdir}/spbita2d.cpp ${sdir}/table.cpp ${sdir}/seti.cpp ${sdir}/sort.cpp ${sdir}/spbita2d.cpp ${sdir}/table.cpp
${sdir}/mpi_interface.cpp ${sdir}/gzstream.cpp ${sdir}/mpi_interface.cpp ${sdir}/gzstream.cpp
) )
install(FILES 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 dynamicmem.hpp flags.hpp hashtabl.hpp mpi_interface.hpp myadt.hpp
ngsimd.hpp mystring.hpp netgenout.hpp ngpython.hpp ngsimd.hpp mystring.hpp netgenout.hpp ngpython.hpp
optmem.hpp parthreads.hpp seti.hpp sort.hpp optmem.hpp parthreads.hpp seti.hpp sort.hpp

View File

@ -159,7 +159,7 @@ template <int BASE = 1>
class BitArrayChar class BitArrayChar
{ {
/// ///
Array<char,BASE> data; NgArray<char,BASE> data;
public: 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++) for (int i = 1; i <= val.Size(); i++)
{ {
strarray->Append (new char[strlen(val.Get(i))+1]); strarray->Append (new char[strlen(val.Get(i))+1]);
@ -67,9 +67,9 @@ namespace netgen
strlistflags.Set (name, strarray); 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++) for (int i = 1; i <= val.Size(); i++)
numarray->Append (val.Get(i)); numarray->Append (val.Get(i));
numlistflags.Set (name, numarray); numlistflags.Set (name, numarray);
@ -118,26 +118,26 @@ namespace netgen
} }
const Array<char*> & const NgArray<char*> &
Flags :: GetStringListFlag (const char * name) const Flags :: GetStringListFlag (const char * name) const
{ {
if (strlistflags.Used (name)) if (strlistflags.Used (name))
return *strlistflags[name]; return *strlistflags[name];
else else
{ {
static Array<char*> dummy_array(0); static NgArray<char*> dummy_array(0);
return dummy_array; return dummy_array;
} }
} }
const Array<double> & const NgArray<double> &
Flags ::GetNumListFlag (const char * name) const Flags ::GetNumListFlag (const char * name) const
{ {
if (numlistflags.Used (name)) if (numlistflags.Used (name))
return *numlistflags[name]; return *numlistflags[name];
else else
{ {
static Array<double> dummy_array(0); static NgArray<double> dummy_array(0);
return dummy_array; return dummy_array;
} }
} }

View File

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

View File

@ -480,7 +480,7 @@ class BASE_INDEX_CLOSED_HASHTABLE
protected: protected:
/// ///
// MoveableArray<INDEX> hash; // MoveableArray<INDEX> hash;
Array<INDEX> hash; NgArray<INDEX> hash;
/// ///
int invalid; int invalid;
public: public:
@ -556,7 +556,7 @@ class INDEX_CLOSED_HASHTABLE : public BASE_INDEX_CLOSED_HASHTABLE
{ {
/// ///
// MoveableArray<T> cont; // MoveableArray<T> cont;
Array<T> cont; NgArray<T> cont;
public: public:
/// ///
@ -653,7 +653,7 @@ class BASE_INDEX_2_CLOSED_HASHTABLE
protected: protected:
/// ///
// MoveableArray<INDEX_2> hash; // MoveableArray<INDEX_2> hash;
Array<INDEX_2> hash; NgArray<INDEX_2> hash;
/// ///
int invalid; int invalid;
size_t mask; size_t mask;
@ -718,7 +718,7 @@ protected:
template <class T> template <class T>
class INDEX_2_CLOSED_HASHTABLE : public BASE_INDEX_2_CLOSED_HASHTABLE class INDEX_2_CLOSED_HASHTABLE : public BASE_INDEX_2_CLOSED_HASHTABLE
{ {
Array<T> cont; NgArray<T> cont;
public: public:
INDEX_2_CLOSED_HASHTABLE (size_t size) INDEX_2_CLOSED_HASHTABLE (size_t size)
: BASE_INDEX_2_CLOSED_HASHTABLE(size), cont(RoundUp2(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 class BASE_INDEX_3_CLOSED_HASHTABLE
{ {
protected: protected:
Array<INDEX_3> hash; NgArray<INDEX_3> hash;
int invalid; int invalid;
size_t mask; size_t mask;
@ -922,7 +922,7 @@ template <class T>
class INDEX_3_CLOSED_HASHTABLE : public BASE_INDEX_3_CLOSED_HASHTABLE class INDEX_3_CLOSED_HASHTABLE : public BASE_INDEX_3_CLOSED_HASHTABLE
{ {
// MoveableArray<T,0> cont; // MoveableArray<T,0> cont;
Array<T,0> cont; NgArray<T,0> cont;
public: public:
INDEX_3_CLOSED_HASHTABLE (int size) 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; size_t used;
/// ///
Array<T_HASH> hash; NgArray<T_HASH> hash;
/// ///
Array<T> cont; NgArray<T> cont;
public: public:
/// ///
ClosedHashTable (size_t asize = 128) 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; ClosedHashTable (ClosedHashTable && ht2) = default;
// who needs that ? // 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)) : size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
{ {
for (auto & v : hash) for (auto & v : hash)

View File

@ -95,7 +95,7 @@ namespace netgen
#endif #endif
#ifdef PARALLEL #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_Comm subcomm;
MPI_Group gcomm, gsubcomm; MPI_Group gcomm, gsubcomm;
@ -105,7 +105,7 @@ namespace netgen
return subcomm; return subcomm;
} }
#else #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; } { return comm; }
#endif #endif
@ -147,20 +147,20 @@ namespace netgen
template <class T, int BASE> 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); MPI_Send( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm);
} }
template <class T, int BASE> 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_Status status;
MPI_Recv( &s.First(), s.Size(), MyGetMPIType<T>(), src, tag, comm, &status); MPI_Recv( &s.First(), s.Size(), MyGetMPIType<T>(), src, tag, comm, &status);
} }
template <class T, int BASE> 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; MPI_Status status;
int len; int len;
@ -172,7 +172,7 @@ namespace netgen
} }
template <class T, int BASE> 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; MPI_Status status;
int len; int len;
@ -191,21 +191,21 @@ namespace netgen
/* /*
template <class T, int BASE> 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); MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
} }
template <class T, int BASE> 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); MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
} }
*/ */
template <class T, int BASE> 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_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request); MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
@ -214,7 +214,7 @@ namespace netgen
template <class T, int BASE> 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_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request); MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
@ -223,7 +223,7 @@ namespace netgen
/* /*
template <class T, int BASE> 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_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &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> 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_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &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_size(comm, &ntasks);
MPI_Comm_rank(comm, &rank); MPI_Comm_rank(comm, &rank);
Array<MPI_Request> requests; NgArray<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++) for (int dest = 0; dest < ntasks; dest++)
if (dest != rank) if (dest != rank)
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm)); requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
@ -288,8 +288,8 @@ namespace netgen
int rank = comm.Rank(); int rank = comm.Rank();
int ntasks = comm.Size(); int ntasks = comm.Size();
Array<int> send_sizes(ntasks); NgArray<int> send_sizes(ntasks);
Array<int> recv_sizes(ntasks); NgArray<int> recv_sizes(ntasks);
for (int i = 0; i < ntasks; i++) for (int i = 0; i < ntasks; i++)
send_sizes[i] = send_data[i].Size(); send_sizes[i] = send_data[i].Size();
@ -304,7 +304,7 @@ namespace netgen
for (int i = 0; i < ntasks; i++) for (int i = 0; i < ntasks; i++)
recv_data.SetEntrySize (i, recv_sizes[i], sizeof(T)); recv_data.SetEntrySize (i, recv_sizes[i], sizeof(T));
Array<MPI_Request> requests; NgArray<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++) for (int dest = 0; dest < ntasks; dest++)
if (dest != rank && send_data[dest].Size()) if (dest != rank && send_data[dest].Size())
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm)); requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
@ -336,7 +336,7 @@ namespace netgen
} }
template <class T> 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(); int size = s.Size();
MyMPI_Bcast (size, comm); MyMPI_Bcast (size, comm);
@ -346,7 +346,7 @@ namespace netgen
} }
template <class T> 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; int id;
MPI_Comm_rank(comm, &id); MPI_Comm_rank(comm, &id);
@ -359,19 +359,19 @@ namespace netgen
} }
template <class T, class T2> 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); MPI_Allgather( const_cast<T*> (&send), 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
} }
template <class T, class T2> 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); MPI_Alltoall( &send[0], 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
} }
// template <class T, class T2> // 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); // 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 "dynamicmem.hpp"
#include "template.hpp" #include "template.hpp"
#include "array.hpp" #include "ngarray.hpp"
#include "table.hpp" #include "table.hpp"
#include "hashtabl.hpp" #include "hashtabl.hpp"

View File

@ -39,13 +39,13 @@ public:
class Procs class Procs
{ {
const netgen::FlatArray<int> procs; const netgen::NgFlatArray<int> procs;
public: 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 #ifndef FILE_NGSTD_NgArrayCPP
#define FILE_NGSTD_ArrayCPP #define FILE_NGSTD_NgArrayCPP
// necessary for SGI ???? // necessary for SGI ????
/**************************************************************************/ /**************************************************************************/
@ -9,7 +9,7 @@
/**************************************************************************/ /**************************************************************************/
/* /*
Abstract data type Array Abstract data type NgArray
*/ */
#include <mystdlib.h> #include <mystdlib.h>
@ -65,11 +65,11 @@ namespace netgen
{ {
if (!actsize) if (!actsize)
{ {
throw Exception ("Array should not be empty"); throw Exception ("NgArray should not be empty");
// cerr << "Array souldn't be empty"; // cerr << "NgArray souldn't be empty";
} }
} }
#endif #endif
} }
#endif #endif // FILE_NGSTD_NgArrayCPP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace netgen
oneblock = NULL; 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()) : data(entrysizes.Size())
{ {
size_t cnt = 0; size_t cnt = 0;

View File

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

View File

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

View File

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

View File

@ -94,7 +94,7 @@ namespace netgen
seg->GetCoeff (coeffs); 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); seg->GetPoints (n, points);
} }
@ -131,12 +131,12 @@ namespace netgen
class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry class SplineGeometry2d : public SplineGeometry<2>, public NetgenGeometry
{ {
protected: protected:
Array<char*> materials; NgArray<char*> materials;
Array<double> maxh; NgArray<double> maxh;
Array<bool> quadmeshing; NgArray<bool> quadmeshing;
Array<bool> tensormeshing; NgArray<bool> tensormeshing;
Array<int> layer; NgArray<int> layer;
Array<string*> bcnames; NgArray<string*> bcnames;
double elto0 = 1.0; 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 leftdomain, int rightdomain, py::object bc, double maxh)
{ {
int n = 1000; int n = 1000;
Array<Point<2>> points; NgArray<Point<2>> points;
for (int i = 0; i <= n; i++) for (int i = 0; i <= n; i++)
{ {
double t = double(i)/n; double t = double(i)/n;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -735,7 +735,7 @@ namespace netgen
/// ///
void ToPlain (const Point3d & p, Point3d & pp) const; 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; void FromPlain (const Point3d & pp, Point3d & p) const;
}; };

View File

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

View File

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

View File

@ -26,23 +26,23 @@ namespace netgen
{ {
// protected: // protected:
public: public:
Array < GeomPoint<D> > geompoints; NgArray < GeomPoint<D> > geompoints;
Array < SplineSeg<D>* > splines; NgArray < SplineSeg<D>* > splines;
SplineGeometry() : geompoints{}, splines{} { ; } SplineGeometry() : geompoints{}, splines{} { ; }
DLL_HEADER ~SplineGeometry(); 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) virtual void DoArchive(Archive& ar)
{ {
ar & geompoints & splines; 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; } { return splines; }
int GetNSplines (void) const { return splines.Size(); } 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: case 3:
{ {
FlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr); NgFlatArray<ElementIndex> ia = mesh->GetTopology().GetVertexElements(vnr);
node.elements.ne = ia.Size(); node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0]; 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.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0]; node.bnd_elements.ptr = (int*)&bia[0];
break; break;
} }
case 2: case 2:
{ {
FlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr); NgFlatArray<SurfaceElementIndex> ia = mesh->GetTopology().GetVertexSurfaceElements(vnr);
node.elements.ne = ia.Size(); node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0]; 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.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0]; node.bnd_elements.ptr = (int*)&bia[0];
break; break;
} }
case 1: case 1:
{ {
FlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr); NgFlatArray<SegmentIndex> ia = mesh->GetTopology().GetVertexSegments(vnr);
node.elements.ne = ia.Size(); node.elements.ne = ia.Size();
node.elements.ptr = (int*)&ia[0]; 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.ne = bia.Size();
node.bnd_elements.ptr = (int*)&bia[0]; node.bnd_elements.ptr = (int*)&bia[0];
break; 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 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); mesh->GetIdentifications().GetPairs (idnr+1, apairs);
for(auto& ind : apairs) for(auto& ind : apairs)
{ {

View File

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

View File

@ -756,7 +756,7 @@ namespace netgen
Ng_BufferMS<int,4> Ngx_Mesh::GetFaceEdges (int fnr) const Ng_BufferMS<int,4> Ngx_Mesh::GetFaceEdges (int fnr) const
{ {
const MeshTopology & topology = mesh->GetTopology(); const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia; NgArrayMem<int,4> ia;
topology.GetFaceEdges (fnr+1, ia); topology.GetFaceEdges (fnr+1, ia);
Ng_BufferMS<int,4> res(ia.Size()); Ng_BufferMS<int,4> res(ia.Size());
for (size_t i = 0; i < ia.Size(); i++) for (size_t i = 0; i < ia.Size(); i++)
@ -1070,7 +1070,7 @@ namespace netgen
int * const indices, int numind) const 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; for (int i = 0; i < numind; i++) dummy[i] = indices[i]+1;
double lam3[3]; double lam3[3];
@ -1111,7 +1111,7 @@ namespace netgen
int * const indices, int numind) const 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; for (int i = 0; i < numind; i++) dummy[i] = indices[i]+1;
Point<3> p3d(p[0], p[1], p[2]); 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: 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]); return std::tuple<int,int*>(dn.Size(), &dn[0]);
} }
case 1: 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]); return std::tuple<int,int*>(dn.Size(), &dn[0]);
} }
case 2: 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]); return std::tuple<int,int*>(dn.Size(), &dn[0]);
} }
default: default:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -427,7 +427,7 @@ namespace netgen
double max, hr; double max, hr;
Array<int> p(n); // pivot-permutation NgArray<int> p(n); // pivot-permutation
Vector hv(n); 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) const Vector & hx, Vector & hy)
{ {
int i, j; 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) const Vector & hx, Vector & hy)
{ {
int i, j; 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 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) if(NOT WIN32)
install( TARGETS mesh ${NG_INSTALL_DIR}) install( TARGETS mesh ${NG_INSTALL_DIR})
endif(NOT WIN32) endif(NOT WIN32)

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