|
[Sponsors] |
How can I make my algorithm for finding duplicates more OpenFOAMic |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 16, 2018, 14:11 |
How can I make my algorithm for finding duplicates more OpenFOAMic
|
#1 |
Member
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11 |
Dear All,
I've coded the following algorithm to find duplicate entries in a List or Field of vectors. I first concatenate the coordinates into a string, compute the hash of this string and then request the uniqueOrder of the container of hashes. However I can't do this without std::string, std::to_string and std::hash. Any tips on how to do this using builtin OpenFOAM structures and functions? Thanks in advance, Victor Code:
List<label> pointBasedStencil::findUniquePoints(const Field<vector>& src) { // create hashes for entries in list using to_string List<label> hashlist; std::hash<std::string> hf; forAll(src,i) { std::string s(std::to_string(src[i].x() ) + std::to_string(src[i].y() ) + std::to_string(src[i].z() ) ); hashlist.append(hf(s) ); } // find unique indices List<label> order; uniqueOrder(hashlist, order); return order; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regarding FoamX running Kindly help out | hariya03 | OpenFOAM Pre-Processing | 0 | April 18, 2008 05:26 |
OpenFOAM with IBM AIX | matthias | OpenFOAM Installation | 20 | March 25, 2008 03:36 |
Compiling OpenFOAM13 on AMD64 with OpenSUSE 101 | silent_missile | OpenFOAM Installation | 5 | August 10, 2007 08:31 |
a way to make lots of money quick and easy no lies | Dob | Main CFD Forum | 0 | October 10, 2006 17:45 |
FOAM installation error gcc amp g | hanks | OpenFOAM Installation | 9 | January 26, 2006 15:14 |