@@ -83,27 +83,30 @@ void WaveletCavity::makeCavity()
8383
8484void WaveletCavity::readCavity (const std::string & filename)
8585{
86- size_t i, j;
86+ size_t i, j, k ;
8787 double x, y, z;
8888
8989 std::ifstream file;
90- file.open (filename.c_str ());
91- file >> nLevels_ >> nPatches_;
92-
93- int nNodes = (1 << nLevels_) + 1 ;
94-
95- nPoints_ = nPatches_ * nNodes * nNodes;
96-
97- for (size_t k = 0 ; k < nPoints_; ++k) {
98- file >> i >> j >> k >> x >> y >> z;
99- Eigen::Vector3i index (i, j, k);
100- nodeIndex_.push_back (index);
101- Eigen::Vector3d point (x, y, z);
102- nodePoint_.push_back (point);
90+ file.open (filename);
91+ if (file.is_open ()) {
92+ file >> nLevels_ >> nPatches_;
93+
94+ int nNodes = (1 << nLevels_) + 1 ;
95+
96+ nPoints_ = nPatches_ * nNodes * nNodes;
97+
98+
99+ for (size_t l = 0 ; l < nPoints_; ++l) {
100+ file >> i >> j >> k >> x >> y >> z;
101+ Eigen::Vector3i index (i, j, k);
102+ nodeIndex_.push_back (index);
103+ Eigen::Vector3d point (x, y, z);
104+ nodePoint_.push_back (point);
105+ }
106+
107+ file.close ();
108+ uploadedDyadic_ = true ;
103109 }
104-
105- file.close ();
106- uploadedDyadic_ = true ;
107110}
108111
109112void WaveletCavity::scaleCavity (const double scalingFactor)
@@ -164,40 +167,49 @@ void WaveletCavity::uploadPoints(int quadLevel, Interpolation *interp)
164167
165168std::ostream & WaveletCavity::printCavity (std::ostream & os)
166169{
170+ // Calculation of quadrature level for printout
171+ int n = 1 << nLevels_;
172+ int quadLevel = int (nElements_ / (nPatches_ * n * n));
167173 os << " Cavity type: Wavelet" << std::endl;
168174 os << " Probe Radius = " << probeRadius_ << std::endl;
169175 os << " Coarsity = " << coarsity_ << std::endl;
170176 os << " Patch Level = " << patchLevel_ << std::endl;
171177 os << " Number of spheres = " << nSpheres_ << std::endl;
172- os << " Number of finite elements = " << nElements_;
173- /* for(int i = 0; i < nElements_; i++)
174- {
178+ os << " Number of patches = " << nPatches_ << std::endl;
179+ os << " Number of levels = " << nLevels_ << std::endl;
180+ os << " Quadrature level = " << quadLevel << std::endl;
181+ os << " Number of potential points = " << nElements_;
182+ os << std::endl;
183+ /*
184+ os << "-------------- Potential points printout " << std::endl;
185+ for(int i = 0; i < nElements_; i++) {
175186 os << std::endl;
176- os << i+1 << " ";
187+ os << "Point " << i+1 << " \n ";
177188 os << elementCenter_(0,i) << " ";
178189 os << elementCenter_(1,i) << " ";
179190 os << elementCenter_(2,i) << " ";
180191 os << elementArea_(i) << " ";
181- }
182- for(int i = 0; i < nSpheres_; i++)
183- {
192+ }
193+ */
194+ /*
195+ for(int i = 0; i < nSpheres_; i++) {
184196 os << endl;
185197 os << i+1 << " ";
186198 os << sphereCenter_(0,i) << " ";
187199 os << sphereCenter_(1,i) << " ";
188200 os << sphereCenter_(2,i) << " ";
189201 os << sphereRadius_(i) << " ";
190- }*/
191- /* if (uploadedDyadic_)
192- {
193- os << "Printing nodes" << std::endl;
194- for(int i = 0; i < nPoints_; i++)
195- {
196- os << std::endl;
197- os << i+1 << " ";
198- os << nodeIndex_[i].transpose() << " " << nodePoint_[i].transpose() << " ";
199- }
200- }*/
202+ }
203+ */
204+ /*
205+ if (uploadedDyadic_) {
206+ os << "Printing nodes" << std::endl;
207+ for(int i = 0; i < nPoints_; i++) {
208+ os << std::endl;
209+ os << i+1 << " ";
210+ os << nodeIndex_[i].transpose() << " " << nodePoint_[i].transpose() << " ";
211+ }
212+ }
213+ */
201214 return os;
202215}
203-
0 commit comments