27 Jun 2019

Echo Linux Release Version

收藏到CSDN网摘
Sometime, I need to recall the Linux version I'm using inside the Virtual Box. I know it's Xubuntu, but which version is it? Usually the commands to do things keep the same. However, they do change from version to version in rare occacions. Type the command below in any terminal window, you'll ge the answer straigh away.

24 Apr 2019

The Best Image Ever That Illustrates High-Order Functions Clearly

收藏到CSDN网摘
Saw this image while surfing the internet. This is far more the best image that illustrates the high-order functions (map, filter, reduce), which works for all programming languages. Check it out! Copied from HERE.



12 Feb 2019

VS2013 Regular Expression Bug? Maybe

收藏到CSDN网摘
I was trying to parse a large file with blocked data using regex library in VS2013. By working in 2 sites, I installed gcc on my Linux machine and VS2013 on Windows. The expression is very simple as "START_INFO[here is the tricky bit]END_INFO", where each block is clearly enclosed by its own start and end information. Inside the [] (square brackets) I'd like to match ALL valid characters. The . (dot) matches almost all but not the newline character and it becomes literal inside the square brackets []. So I came up with an alternative solution "[\s\S]+?" which should guide the program to search all whitespace and non-whitespace characters until it reaches the END_INFO.

10 Sept 2018

C++ I/O Tips: Saving Huge Text File using Boost Library

收藏到CSDN网摘
以前这篇文章写过利用Boost的内存映射来读取超大文件,但是读取的目的最终还是要写入结果文件.网络上使用Boost来读取文件的例子不少,但是写文件的例子则寥寥无几.记录一下,以备将来使用.

28 Aug 2018

Tetrahedron Properties

收藏到CSDN网摘

做CFD与FEA分析,经常要与网格打交道.而FEA分析最常用的网格大概就数四面体网格了(tetrahedron).无论是4-node还是10-node,其几何形状都是经典的三棱锥.本文记录一些用到的四面体属性知识.

25 Jul 2018

C++ I/O Tips: Parsing Huge Text File

收藏到CSDN网摘

问题提出


最近项目需要读取mesh文件,基本做过CFD的都知道,几千万Elements的mesh文件动辄几个Gb,庞大的体积让各种操作都很不方便.而获取数据需要与磁盘打交道,作为后续处理的第一步,是一切的开端.如果需要读取的文件是二进制格式,会有些帮助.但是不同的网格划分软件大都有其自有格式,等于是带着枷锁跳舞.

注意:这里的测试使用的都是文本文件,可能不适用于二进制文件读写.

下文使用的开发环境: VS2013 + Win10 + i7 CPU/16G Ram.
测试数据是ICEM导出的Star-CD的vrt格式.这种格式可以看作是文本文件,每一行一组数据表示一个Node(也就是一个三维点): Node_ID X Y Z.Mesh有多少个Node,文件就有多少行.