00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 #ifndef ListOps_H
00037 #define ListOps_H
00038 
00039 #include <OpenFOAM/labelList.H>
00040 
00041 
00042 
00043 namespace Foam
00044 {
00045 
00046 
00047 
00048 template<class ListType>
00049 ListType renumber(const UList<label>& oldToNew, const ListType&);
00050 
00051 
00052 
00053 template<class ListType>
00054 void inplaceRenumber(const UList<label>& oldToNew, ListType&);
00055 
00056 
00057 
00058 
00059 template<class ListType>
00060 ListType reorder(const UList<label>& oldToNew, const ListType&);
00061 
00062 
00063 
00064 template<class ListType>
00065 void inplaceReorder(const UList<label>& oldToNew, ListType&);
00066 
00067 
00068 
00069 
00070 
00071 
00072 template<class Container>
00073 void inplaceMapValue(const UList<label>& oldToNew, Container&);
00074 
00075 
00076 template<class Container>
00077 void inplaceMapKey(const UList<label>& oldToNew, Container&);
00078 
00079 
00080 
00081 template<class T>
00082 void sortedOrder(const UList<T>&, labelList& order);
00083 
00084 
00085 template<class T>
00086 void duplicateOrder(const UList<T>&, labelList& order);
00087 
00088 
00089 template<class T>
00090 void uniqueOrder(const UList<T>&, labelList& order);
00091 
00092 
00093 
00094 
00095 template<class T, class ListType>
00096 ListType subset(const UList<T>& select, const T& value, const ListType&);
00097 
00098 
00099 
00100 
00101 template<class T, class ListType>
00102 void inplaceSubset(const UList<T>& select, const T& value, ListType&);
00103 
00104 
00105 
00106 
00107 
00108 template<class BoolListType, class ListType>
00109 ListType subset(const BoolListType& select, const ListType&);
00110 
00111 
00112 
00113 
00114 
00115 template<class BoolListType, class ListType>
00116 void inplaceSubset(const BoolListType& select, ListType&);
00117 
00118 
00119 labelList invert(const label len, const UList<label>&);
00120 
00121 
00122 labelListList invertOneToMany(const label len, const UList<label>&);
00123 
00124 
00125 
00126 
00127 template<class InList, class OutList>
00128 void invertManyToMany(const label len, const UList<InList>&, List<OutList>&);
00129 
00130 template<class InList, class OutList>
00131 List<OutList> invertManyToMany(const label len, const UList<InList>& in)
00132 {
00133     List<OutList> out;
00134     invertManyToMany<InList,OutList>(len, in, out);
00135     return out;
00136 }
00137 
00138 
00139 labelList identity(const label len);
00140 
00141 
00142 
00143 template<class ListType>
00144 label findIndex
00145 (
00146     const ListType&,
00147     typename ListType::const_reference,
00148     const label start=0
00149 );
00150 
00151 
00152 template<class ListType>
00153 labelList findIndices
00154 (
00155     const ListType&,
00156     typename ListType::const_reference,
00157     const label start=0
00158 );
00159 
00160 
00161 template<class ListType>
00162 void setValues
00163 (
00164     ListType&,
00165     const UList<label>& indices,
00166     typename ListType::const_reference
00167 );
00168 
00169 
00170 template<class ListType>
00171 ListType createWithValues
00172 (
00173     const label sz,
00174     typename ListType::const_reference initValue,
00175     const UList<label>& indices,
00176     typename ListType::const_reference setValue
00177 );
00178 
00179 
00180 
00181 template<class ListType>
00182 label findMax(const ListType&, const label start=0);
00183 
00184 
00185 
00186 
00187 template<class ListType>
00188 label findMin(const ListType&, const label start=0);
00189 
00190 
00191 
00192 
00193 template<class ListType>
00194 label findSortedIndex
00195 (
00196     const ListType&,
00197     typename ListType::const_reference,
00198     const label start=0
00199 );
00200 
00201 
00202 
00203 
00204 template<class ListType>
00205 label findLower
00206 (
00207     const ListType&,
00208     typename ListType::const_reference,
00209     const label start=0
00210 );
00211 
00212 
00213 
00214 
00215 template<class Container, class T, int nRows>
00216 List<Container> initList(const T[nRows]);
00217 
00218 
00219 
00220 
00221 template<class Container, class T, int nRows, int nColumns>
00222 List<Container> initListList(const T[nRows][nColumns]);
00223 
00224 
00225 
00226 
00227 } 
00228 
00229 
00230 
00231 #ifdef NoRepository
00232 #   include "ListOpsTemplates.C"
00233 #endif
00234 
00235 
00236 
00237 #endif
00238 
00239 
00240