Skip to content

Commit

Permalink
Merge pull request #3 from dfvankomen/master
Browse files Browse the repository at this point in the history
DendroRegister definition, Adjusting Rotations, and Clangformat file
  • Loading branch information
dfvankomen authored Dec 4, 2023
2 parents 5dbcfa6 + bdec0c8 commit 3ae9fe2
Show file tree
Hide file tree
Showing 8 changed files with 358 additions and 170 deletions.
168 changes: 168 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...

4 changes: 2 additions & 2 deletions FEM/include/matvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ inline void fem::seq::matvec(const T *pt_coords,const da* in,unsigned int pBegin
const unsigned int ny=order+1;
const unsigned int nz=order+1;

register unsigned int ijk[3];
DendroRegister unsigned int ijk[3];
unsigned int cnum;
const unsigned int pMin[]={pOctant.minX(),pOctant.minY(),pOctant.minZ()};
const unsigned int pMax[]={pOctant.maxX(),pOctant.maxY(),pOctant.maxZ()};
Expand All @@ -221,7 +221,7 @@ inline void fem::seq::matvec(const T *pt_coords,const da* in,unsigned int pBegin
ot::TreeNode childElem[NUM_CHILDREN];


register unsigned int pt_status;
DendroRegister unsigned int pt_status;
childElem[0]=ot::TreeNode(pOctant.minX(),pOctant.minY(),pOctant.minZ(),pOctant.getLevel()+1,m_uiDim,maxDepth);
childElem[1]=ot::TreeNode(pOctant.minX()+szb2,pOctant.minY(),pOctant.minZ(),pOctant.getLevel()+1,m_uiDim,maxDepth);
childElem[2]=ot::TreeNode(pOctant.minX(),pOctant.minY()+szb2,pOctant.minZ(),pOctant.getLevel()+1,m_uiDim,maxDepth);
Expand Down
89 changes: 51 additions & 38 deletions include/dendro.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
/**
* @file dendro.h
* @brief Basic dendro data types and definitions.
* @brief Basic dendro data types and definitions.
* @version 0.1
* @date 2016-02-08
*
*
* @copyright Copyright (c) 2022
*
*
*/
#pragma once
#include <climits>
#include <complex>
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>

#include <climits>
#include <complex>
#include <iostream>

/**
* ==== C++ Standard-Based Definitions ====
*
* Any sort of definitions that need to be made based on used C++ standard
*/
#ifndef __cplusplus
#error C++ is required
#elif __cplusplus < 201703L
// NOTE: The register keyword was depreciated in C++17, but it left for older
// standards
#define DendroRegister register
#else
#define DendroRegister
#endif

/**
* ==== Console Output Colors ====
*
*/
#define RED "\e[1;31m"
#define BLU "\e[2;34m"
#define GRN "\e[0;32m"
Expand All @@ -27,24 +45,23 @@
#define CYN "\e[0;36m"
#define NRM "\e[0m"



/**
* ==== Data-type Definitions ====
*
*/
#ifdef USE_64BIT_INDICES
#define DendroIntL long long
#define DendroIntLSpecifier %lld
#define DendroUIntLSpecifier %llu
#define DendroIntLSpecifier % lld
#define DendroUIntLSpecifier % llu
#else
#define DendroIntL unsigned int
#define DendroIntLSpecifier %d
#define DendroUIntLSpecifier %u
#define DendroIntLSpecifier % d
#define DendroUIntLSpecifier % u
#endif


#define DendroScalar double
#define DendroComplex std::complex<double>



//#define DendroIntL unsigned int
typedef unsigned __int128 DendroUInt_128;

Expand All @@ -57,12 +74,12 @@ typedef unsigned __int128 DendroUInt_128;
// mesh.h # defines.
#define LOOK_UP_TABLE_DEFAULT UINT_MAX


// TreeNode.h # defines.

/**
* Following are the flags that used to mark treeNodes when generating keys and mesh generation.
* all these flags are stored in m_uiLevel since we know that, we need only 4 bits to store the level of the octree.
* Following are the flags that used to mark treeNodes when generating keys and
* mesh generation. all these flags are stored in m_uiLevel since we know that
* we need only 4 bits to store the level of the octree.
*
* bit -0 to bit -4 : level of the octant
* bit -5 to 13 : are the Key flags.
Expand All @@ -73,17 +90,18 @@ typedef unsigned __int128 DendroUInt_128;
* */
#define OCT_FOUND 32
#define OCT_KEY_NONE 64
#define OCT_KEY_SPLITTER 128
#define OCT_KEY_UP 256
#define OCT_KEY_DOWN 512
#define OCT_KEY_FRONT 1024
#define OCT_KEY_BACK 2048
#define OCT_KEY_LEFT 4096
#define OCT_KEY_RIGHT 8192
#define OCT_KEY_SPLITTER 128
#define OCT_KEY_UP 256
#define OCT_KEY_DOWN 512
#define OCT_KEY_FRONT 1024
#define OCT_KEY_BACK 2048
#define OCT_KEY_LEFT 4096
#define OCT_KEY_RIGHT 8192

/**
*
* Note: Don't change that below numbering for key direction. With the following numbering you can always get the opposite direction performing XOR with 1.
* Note: Don't change that below numbering for key direction. With the following
* numbering you can always get the opposite direction performing XOR with 1.
* Example OCT_DIR_LEFT= 1 XOR OCT_DIR_RIGHT
*
* */
Expand All @@ -100,7 +118,6 @@ typedef unsigned __int128 DendroUInt_128;
#define OCT_DIR_LEFT_BACK 8
#define OCT_DIR_LEFT_FRONT 9


#define OCT_DIR_RIGHT_DOWN 10
#define OCT_DIR_RIGHT_UP 11
#define OCT_DIR_RIGHT_BACK 12
Expand All @@ -109,7 +126,6 @@ typedef unsigned __int128 DendroUInt_128;
#define OCT_DIR_DOWN_BACK 14
#define OCT_DIR_DOWN_FRONT 15


#define OCT_DIR_UP_BACK 16
#define OCT_DIR_UP_FRONT 17

Expand All @@ -125,10 +141,10 @@ typedef unsigned __int128 DendroUInt_128;

#define OCT_DIR_TOTAL 27

/** variable to ensure the element sz % element order =0 for higher order elemnts */
/** variable to ensure the element sz % element order =0 for higher order
* elemnts */
extern unsigned int MAXDEAPTH_LEVEL_DIFF;


#define NUM_LEVEL_BITS 5u

#ifdef DIM_2
Expand Down Expand Up @@ -162,25 +178,21 @@ extern unsigned int MAXDEAPTH_LEVEL_DIFF;
#define F2E_FACE_INDEPEN_BIT 3
#define F2E_FACE_DEPEN_BIT 4


// AMR coarsening factor.
#define DENDRO_AMR_COARSEN_FAC 0.1

#define DENDRO_DEFAULT_LB_TOL 0.1
#define DENDRO_DEFAULT_SF_K 2
#define DENDRO_DEFAULT_GRAIN_SZ 100


#define DENDRO_UNSIGNED_INT_MIN UINT_MIN
#define DENDRO_UNSIGNED_INT_MAX UINT_MAX

#define DENDRO_REMESH_UNZIP_SCALE_FAC 1.0


#define DENDRO_BLOCK_ALIGN_FACTOR 1
#define DENDRO_BLOCK_ALIGN_FACTOR_LOG 0


#define ODA_INDEPENDENT_FLAG_BIT 0
#define ODA_W_DEPENDENT_FLAG_BIT 1
#define ODA_W_BOUNDARY_FLAG_BIT 2
Expand All @@ -189,9 +201,10 @@ extern unsigned int MAXDEAPTH_LEVEL_DIFF;

void __handler(int sig);

inline int dendro_error(const char* const file, int line, const std::string& msg){
std::cout<< "[" << file << "] : "<<line<<" "<< msg <<std::endl;
return 0;
inline int dendro_error(const char* const file, int line,
const std::string& msg) {
std::cout << "[" << file << "] : " << line << " " << msg << std::endl;
return 0;
}

#define dendro_log(msg) dendro_error(__FILE__, __LINE__, msg)
5 changes: 3 additions & 2 deletions include/hcurvedata.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

const int _2D_HILBERT_TABLE=16;
const int _3D_HILBERT_TABLE=192;
const int _2D_ROTATIONS_SIZE=32;
const int _3D_ROTATIONS_SIZE=384;
// rotations size needs to be +1 to avoid overwriting shadow blocks upon strcpy (fsanatize reveals this "bug")
const int _2D_ROTATIONS_SIZE=32 + 1;
const int _3D_ROTATIONS_SIZE=384 + 1;


extern char* HILBERT_TABLE;
Expand Down
Loading

0 comments on commit 3ae9fe2

Please sign in to comment.