www.cemf.ir
contactSearch.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #include "contactSearch.hpp"
22 #include "streams.hpp"
23 #include "particles.hpp"
24 
25 
27  const dictionary& dict,
28  const box& extDomain,
29  const particles& prtcl,
30  const geometry& geom,
31  Timers& timers)
32 :
33  extendedDomainBox_(extDomain),
34  particles_(prtcl),
35  geometry_(geom),
36  bTimer_("Boundary particles contact search", &timers),
37  ppTimer_("Internal particles contact search", &timers),
38  dict_(dict)
39 {
40 
41 }
42 
44 {
45  return particles_.pStruct();
46 }
47 
49 (
50  const timeInfo &ti,
51  csPairContainerType &ppPairs,
52  csPairContainerType &pwPairs,
53  bool force
54 )
55 {
56 
57  if(enterBroadSearch(ti, force))
58  {
59  ppTimer_.start();
60  if( !BroadSearch(
61  ti,
62  ppPairs,
63  pwPairs,
64  force ) )
65  {
67  performedSearch_ = false;
68  return false;
69  }
70  ppTimer_.end();
71  performedSearch_ = true;
72  }
73  else
74  {
75  performedSearch_ = false;
76  }
77 
78  return true;
79 }
80 
82 (
83  uint32 bndryIndex,
84  const timeInfo &ti,
85  csPairContainerType &ppPairs,
86  csPairContainerType &pwPairs,
87  bool force
88 )
89 {
90  if(enterBroadSearchBoundary(ti, force))
91  {
92  bTimer_.start();
93  for(uint32 i=0u; i<6u; i++)
94  {
95  if(!BoundaryBroadSearch(
96  i,
97  ti,
98  ppPairs,
99  pwPairs,
100  force))
101  {
102  performedSearchBoundary_ = false;
103  return false;
104  }
105  }
106  bTimer_.end();
107  performedSearchBoundary_ = true;
108  }
109  else
110  {
111 
112  performedSearchBoundary_ = false;
113  }
114 
115  return true;
116 }
117 
119  const dictionary &dict,
120  const box &extDomain,
121  const particles &prtcl,
122  const geometry &geom,
123  Timers &timers)
124 {
125  word baseMethName = dict.getVal<word>("method");
126 
127  auto model = angleBracketsNames("ContactSearch", baseMethName);
128 
129  pOutput.space(2)<<"Selecting contact search model "<<Green_Text(model)<<endl;
130  if( dictionaryvCtorSelector_.search(model))
131  {
132  auto objPtr = dictionaryvCtorSelector_[model] (dict, extDomain, prtcl, geom, timers);
133  return objPtr;
134  }
135  else
136  {
137  printKeys
138  (
139  fatalError << "Ctor Selector "<< model << " does not exist. \n"
140  <<"Avaiable ones are: \n\n"
141  ,
142  dictionaryvCtorSelector_
143  );
144  fatalExit;
145  }
146 
147  return nullptr;
148 }
Green_Text
#define Green_Text(text)
Definition: iOstream.hpp:42
pFlow::pOutput
processorOstream pOutput
pFlow::contactSearch::contactSearch
contactSearch(const dictionary &dict, const box &extDomain, const particles &prtcl, const geometry &geom, Timers &timers)
Definition: contactSearch.cpp:26
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::contactSearch::broadSearch
bool broadSearch(const timeInfo &ti, csPairContainerType &ppPairs, csPairContainerType &pwPairs, bool force=false)
Definition: contactSearch.cpp:49
pFlow::contactSearch::create
static uniquePtr< contactSearch > create(const dictionary &dict, const box &extDomain, const particles &prtcl, const geometry &geom, Timers &timers)
Definition: contactSearch.cpp:118
pFlow::printKeys
iOstream & printKeys(iOstream &os, const wordHashMap< T > &m)
pFlow::contactSearch::boundaryBroadSearch
bool boundaryBroadSearch(uint32 bndryIndex, const timeInfo &ti, csPairContainerType &ppPairs, csPairContainerType &pwPairs, bool force=false)
Definition: contactSearch.cpp:82
particles.hpp
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::contactSearch::pStruct
const pointStructure & pStruct() const
Definition: contactSearch.cpp:43
pFlow::Timers
Definition: Timers.hpp:32
pFlow::timeInfo
Definition: timeInfo.hpp:28
pFlow::unsortedPairs
Definition: unsortedPairs.hpp:32
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::particles
Definition: particles.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::angleBracketsNames
word angleBracketsNames(const word &w1, const word &w2)
Output <w1,w2>
Definition: bTypesFunctions.cpp:156
fatalError
#define fatalError
Report a fatal error and exit the applicaiton.
Definition: error.hpp:70
streams.hpp
pFlow::dictionary::getVal
T getVal(const word &keyword) const
get the value of data entry
Definition: dictionary.hpp:379
pFlow::box
Definition: box.hpp:32
pFlow::uniquePtr< pFlow::contactSearch >
pFlow::geometry
Base class for geometry for managing tri-surfaces, geometry motion, and surface physical properties.
Definition: geometry.hpp:44
contactSearch.hpp
pFlow::iOstream::space
virtual iOstream & space(int32 n=1)
Write space to stream.
Definition: iOstream.cpp:119
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67