recentpopularlog in

aries1988 : c++   19

Field value inside a boundary condition class -- CFD Online Discussion Forums
You have the access member function const objectRegistry& db() const. Accessing for example U is done by the code:

const volVectorField& U = db().lookupObject<volVectorField>("U");
For accessing the mesh: when creating a boundary condition, you have access to the patch. You can thus access the mesh with:

const fvMesh& mesh = patch().boundaryMesh().mesh();
c++  ofm  bc 
november 2018 by aries1988
The codedFixedValue boundary condition - sourceflux
We want to be able to set the individual face centered values differently depending on some spatial and/or temporal conditions. This requires a non-constant access to the field stored in our coded boundary condition. Well, as noted before, the coded boundary condition is a fvPatchField and fvPatchField is a Field<Type>. Since we are working with the volVectorField U, we can upcast the coded boundary condition to its grandparent class Field<vector> a.k.a. vectorField, and work with that.
ofm  c++ 
november 2018 by aries1988
普适性准则 每行最大80个字符 缩进默认4个占位符 使用空格进行缩进,而不是TAB按键 if,else,while,case,for使用的时候附加空格,forAll后不附加空格 前默认空置4个字符并对齐 如 Info<< ... os << ... 下面这种是不正确的: WarningInFunction << "Warning message" 省略没必要的注释 类声明注释居中显示如 /*-----------------------------------------...
best  practice  code  howto  habit  c++  ofm 
july 2018 by aries1988
C++: Where to initialize variables in constructor - Stack Overflow
down vote
In short, always prefer initialization lists when possible. 2 reasons:

If you do not mention a variable in a class's initialization list, the constructor will default initialize it before entering the body of the constructor you've written. This means that option 2 will lead to each variable being written to twice, once for the default initialization and once for the assignment in the constructor body.

Also, as mentioned by mwigdahl and avada in other answers, const members and reference members can only be initialized in an initialization list.

Also note that variables are always initialized on the order they are declared in the class declaration, not in the order they are listed in an initialization list (with proper warnings enabled a compiler will warn you if a list is written out of order). Similarly, destructors will call member destructors in the opposite order, last to first in the class declaration, after the code in your class's destructor has executed.
c++  explained 
february 2018 by aries1988
因为最近又开始重写求解器代码,代码又搞得有点多。本篇文章谈一谈OpenFOAM代码方面的杂七杂八,不谈CFD算法,只是编程,算是这些年写代码,重写代码,再重写代码,再再重写代码的总结。 OpenFOAM的入门请参考:OpenFOAM入门建议 第一句:可能有些刚入门CFD的朋友不知道我说的是什么,但你总会明白的。 开源和闭源 现在CFD软件非常多,相对于ANSYS Fluent,OpenFOAM最大的特点是开源,也就是代码是公开的。因此我们可以从代码这方面把所有的CFD软件分为: 闭源CFD求解器,例如...
programming  c++  ofm 
february 2018 by aries1988
C char array initialization - Stack Overflow
First, in C, there is no such thing as an empty char. You can use double quotes to designate an empty string, as with:

char* buf = "";
That will give you a pointer to a NUL string, i.e., a single-character string with only the NUL character in it. But you cannot use single quotes with nothing inside them--that is undefined. If you need to designate the NUL character, you have to specify it:
c  c++  explained  programming  vector 
october 2017 by aries1988
Philip Blakely Post-Doctoral Research Associate
Introduction to Linux

Scientific Programming in C++

Introduction to CUDA
resource  c++  cuda  linux 
july 2017 by aries1988
c++ - What does T&& (double ampersand) mean in C++11? - Stack Overflow
rvalue references primarily provide for the following:

Move semantics.
c++  2017  moi 
june 2017 by aries1988

Copy this bookmark:

to read