Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 52 additions & 38 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,49 +1,63 @@
---
Language: Cpp
BasedOnStyle: Microsoft
BasedOnStyle: LLVM

AlwaysBreakTemplateDeclarations: Yes
ColumnLimit: 120

AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
#AlwaysBreakTemplateDeclarations: Yes
#
#AllowAllArgumentsOnNextLine: false
#AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: false
BinPackParameters: false

BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true

Cpp11BracedListStyle: true
FixNamespaceComments: true

# InsertBraces: true # only for clang-format version15.0.0 or later

# About include
IncludeBlocks: Regroup
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''

PackArguments:
BinPack: UseBreakAfter
BreakAfter: 3
PackParameters:
BinPack: UseBreakAfter
BreakAfter: 3
#
#BreakBeforeBinaryOperators: None
#BreakBeforeTernaryOperators: true
BreakBeforeBraces: Allman
BreakAfterOpenBracketFunction: true
AlignAfterOpenBracket: DontAlign
#
#Cpp11BracedListStyle: true
#FixNamespaceComments: true
#
InsertBraces: true # only for clang-format version15.0.0 or later
#
## About include
#IncludeBlocks: Regroup
#IncludeIsMainRegex: '([-_](test|unittest))?$'
#IncludeIsMainSourceRegex: ''
#
IndentWidth: 4
IndentWrappedFunctionNames: true

# About Point
DerivePointerAlignment: false
PointerAlignment: Left

ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true

# About space
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#IndentWrappedFunctionNames: true
#
## About Point
#DerivePointerAlignment: false
#PointerAlignment: Left
PenaltyBreakBeforeMemberAccess: 1000
PenaltyBreakScopeResolution: 1000

#
#ReflowComments: true
#SortIncludes: true
#SortUsingDeclarations: true
#
## About space
#SpaceAfterCStyleCast: false
#SpaceAfterLogicalNot: false
#SpaceBeforeRangeBasedForLoopColon: false
#SpaceInEmptyParentheses: false
#SpacesInAngles: false
#SpacesInCStyleCastParentheses: false
#SpacesInContainerLiterals: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#
Standard: c++11
TabWidth: 4
UseTab: Never
Expand Down
6 changes: 2 additions & 4 deletions source/source_hsolver/diag_comm_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ struct diag_comm_info
const int nproc;

#ifndef __MPI
diag_comm_info(const int rank_in, const int nproc_in) : rank(rank_in), nproc(nproc_in)
{
}
diag_comm_info(const int rank_in, const int nproc_in) : rank(rank_in), nproc(nproc_in) {}
#else
const MPI_Comm comm;
diag_comm_info(const MPI_Comm& comm_in, const int rank_in, const int nproc_in)
diag_comm_info(const MPI_Comm &comm_in, const int rank_in, const int nproc_in)
: comm(comm_in), rank(rank_in), nproc(nproc_in)
{
}
Expand Down
12 changes: 4 additions & 8 deletions source/source_hsolver/diag_const_nums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ template class const_nums<std::complex<double>>;
template class const_nums<std::complex<float>>;

// Specialize templates to support double types
template <>
const_nums<double>::const_nums()
template <> const_nums<double>::const_nums()
{
base_device::memory::resize_memory_op<double, base_device::DEVICE_CPU>()(this->zero, 1);
this->zero[0] = 0.0;
Expand All @@ -20,8 +19,7 @@ const_nums<double>::const_nums()
}

// Specialize templates to support double types
template <>
const_nums<float>::const_nums()
template <> const_nums<float>::const_nums()
{
base_device::memory::resize_memory_op<float, base_device::DEVICE_CPU>()(this->zero, 1);
this->zero[0] = 0.0;
Expand All @@ -32,8 +30,7 @@ const_nums<float>::const_nums()
}

// Specialized templates to support std:: std::complex<double>types
template <>
const_nums<std::complex<double>>::const_nums()
template <> const_nums<std::complex<double>>::const_nums()
{
base_device::memory::resize_memory_op<std::complex<double>, base_device::DEVICE_CPU>()(this->zero, 1);
this->zero[0] = std::complex<double>(0.0, 0.0);
Expand All @@ -44,8 +41,7 @@ const_nums<std::complex<double>>::const_nums()
}

// Specialized templates to support std:: complex<float>types
template <>
const_nums<std::complex<float>>::const_nums()
template <> const_nums<std::complex<float>>::const_nums()
{
base_device::memory::resize_memory_op<std::complex<float>, base_device::DEVICE_CPU>()(this->zero, 1);
this->zero[0] = std::complex<float>(0.0, 0.0);
Expand Down
11 changes: 5 additions & 6 deletions source/source_hsolver/diag_const_nums.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
#define DIAG_CONST_NUMS
#include "source_base/module_device/memory_op.h"

template <typename T>
struct const_nums
template <typename T> struct const_nums
{
const_nums();
base_device::DEVICE_CPU* cpu_ctx = {};
T* zero = nullptr;
T* one = nullptr;
T* neg_one = nullptr;
base_device::DEVICE_CPU *cpu_ctx = {};
T *zero = nullptr;
T *one = nullptr;
T *neg_one = nullptr;
};

#endif
Loading
Loading